Skip to main content
This package has been archived, and as such it is read-only.

@std/archive@0.225.4
Built and signed on GitHub Actions

DEPRECATED: Use @std/tar

This package works with Deno
This package works with Deno
JSR Score
94%
Published
6 months ago (0.225.4)
Deprecated

Use @std/tar instead. @std/archive will be removed in the future.

Tar is a utility for collecting multiple files (or any arbitrary data) into one archive file, while untar is the inverse utility to extract the files from an archive. Files are not compressed, only collected into the archive.

import { Tar } from "@std/archive/tar";
import { Buffer } from "@std/io/buffer";
import { copy } from "@std/io/copy";

const tar = new Tar();

// Now that we've created our tar, let's add some files to it:

const content = new TextEncoder().encode("Some arbitrary content");
await tar.append("deno.txt", {
  reader: new Buffer(content),
  contentSize: content.byteLength,
});

// This file is sourced from the filesystem (and renamed in the archive)
await tar.append("filename_in_archive.txt", {
  filePath: "./filename_on_filesystem.txt",
});

// Now let's write the tar (with its two files) to the filesystem
// use tar.getReader() to read the contents.

const writer = await Deno.open("./out.tar", { write: true, create: true });
await copy(tar.getReader(), writer);
writer.close();
Built and signed on
GitHub Actions
View transparency log

Add Package

deno add jsr:@std/archive

Import symbol

import * as archive from "@std/archive";

---- OR ----

Import directly with a jsr specifier

import * as archive from "jsr:@std/archive";