@ende/tar

ende add jsr:@ende/tar

Version 2026.10.15 on JSR.

Streaming utilities for working with tar archives.

Files are not compressed, only collected into the archive.

import { UntarStream } from "@ende/tar/untar-stream";
import { dirname, normalize } from "@ende/path";

for await (
  const entry of (await Ende.open("./out.tar.gz"))
    .readable
    .pipeThrough(new DecompressionStream("gzip"))
    .pipeThrough(new UntarStream())
) {
  const path = normalize(entry.path);
  await Ende.mkdir(dirname(path), { recursive: true });
  await entry.readable?.pipeTo((await Ende.create(path)).writable);
}

Modules

Exports

  • assertValidLinkname — Asserts that the linkname provided is valid for a TarStream.
  • assertValidPath — Asserts that the path provided is valid for a TarStream.
  • assertValidTarStreamOptions — Asserts that the options provided are valid for a TarStream.
  • OldStyleFormat — The original tar archive header format.
  • PosixUstarFormat — The POSIX ustar archive header format.
  • TarStream — ### Overview A TransformStream to create a tar archive. Tar archives allow for storing multiple files in a single file (called an archive, or sometimes a tarball). These archives typically have a single '.tar' extension. This implementation follows the FreeBSD 15.0 spec.
  • TarStreamDir — The interface required to provide a directory.
  • TarStreamEntry — The structure of an entry extracted from a Tar archive.
  • TarStreamFile — The interface required to provide a file.
  • TarStreamInput — A union type merging all the TarStream interfaces that can be piped into the TarStream class.
  • TarStreamOptions — The options that can go along with a file or directory.
  • TarStreamSymlink — The interface required to provide a symbolic link.
  • Uint8Array_ — Proxy type of {@code Uint8Array<ArrayBuffer>} or {@code Uint8Array} in TypeScript 5.7 or below respectively.
  • UntarStream — ### Overview A TransformStream to expand a tar archive. Tar archives allow for storing multiple files in a single file (called an archive, or sometimes a tarball).