Class UntarStreamExperimental
Implements
- TransformStream<Uint8Array, TarStreamEntry>
Index
Constructors
Accessors
Constructors
constructor
- new
Untar (): UntarStreamStream ExperimentalReturns UntarStream
Accessors
readable
- get readable(): ReadableStream<TarStreamEntry>
ExperimentalThe ReadableStream
Returns ReadableStream<TarStreamEntry>
ReadableStream
Example: Usage
import { UntarStream } from "@std/tar/untar-stream";
import { dirname, normalize } from "@std/path";
for await (
const entry of (await Deno.open("./out.tar.gz"))
.readable
.pipeThrough(new DecompressionStream("gzip"))
.pipeThrough(new UntarStream())
) {
const path = normalize(entry.path);
await Deno.mkdir(dirname(path), { recursive: true });
await entry.readable?.pipeTo((await Deno.create(path)).writable);
}
writable
- get writable(): WritableStream<Uint8Array>
ExperimentalThe WritableStream
Returns WritableStream<Uint8Array>
WritableStream
Example: Usage
import { UntarStream } from "@std/tar/untar-stream";
import { dirname, normalize } from "@std/path";
for await (
const entry of (await Deno.open("./out.tar.gz"))
.readable
.pipeThrough(new DecompressionStream("gzip"))
.pipeThrough(new UntarStream())
) {
const path = normalize(entry.path);
await Deno.mkdir(dirname(path));
await entry.readable?.pipeTo((await Deno.create(path)).writable);
}
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).
These archives typically have a single '.tar' extension. This implementation follows the FreeBSD 15.0 spec.
Supported File Formats
Only the ustar file format is supported. This is the most common format. Additionally the numeric extension for file size.
Usage
When expanding the archive, as demonstrated in the example, one must decide to either consume the ReadableStream property, if present, or cancel it. The next entry won't be resolved until the previous ReadableStream is either consumed or cancelled.
Understanding Compressed
A tar archive may be compressed, often identified by an additional file extension, such as '.tar.gz' for gzip. This TransformStream does not support decompression which must be done before expanding the archive.
UNSTABLE: New API, yet to be vetted.
Example: Usage