Class TarStreamExperimental
Implements
- TransformStream<TarStreamInput, Uint8Array>
Index
Constructors
Accessors
Accessors
readable
- get readable(): ReadableStream<Uint8Array>
ExperimentalThe ReadableStream
Returns ReadableStream<Uint8Array>
ReadableStream
Example: Usage
import { TarStream } from "@std/tar/tar-stream";
await ReadableStream.from([
{
type: "directory",
path: 'potato/'
},
{
type: "file",
path: 'deno.json',
size: (await Deno.stat('deno.json')).size,
readable: (await Deno.open('deno.json')).readable
},
{
type: "file",
path: '.vscode/settings.json',
size: (await Deno.stat('.vscode/settings.json')).size,
readable: (await Deno.open('.vscode/settings.json')).readable
}
])
.pipeThrough(new TarStream())
.pipeThrough(new CompressionStream('gzip'))
.pipeTo((await Deno.create('./out.tar.gz')).writable)
writable
- get writable(): WritableStream<TarStreamInput>
ExperimentalThe WritableStream
Returns WritableStream<TarStreamInput>
WritableStream
Example: Usage
import { TarStream } from "@std/tar/tar-stream";
await ReadableStream.from([
{
type: "directory",
path: 'potato/'
},
{
type: "file",
path: 'deno.json',
size: (await Deno.stat('deno.json')).size,
readable: (await Deno.open('deno.json')).readable
},
{
type: "file",
path: '.vscode/settings.json',
size: (await Deno.stat('.vscode/settings.json')).size,
readable: (await Deno.open('.vscode/settings.json')).readable
}
])
.pipeThrough(new TarStream())
.pipeThrough(new CompressionStream('gzip'))
.pipeTo((await Deno.create('./out.tar.gz')).writable)
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.
File Format & Limitations
The ustar file format is used for creating the tar archive. While this format is compatible with most tar readers, the format has several limitations, including:
sizeExtensionis set to true.Usage
TarStream may throw an error for several reasons. A few of those are:
Compression
Tar archives are not compressed by default. If you'd like to compress the archive, you may do so by piping it through a compression stream.
UNSTABLE: New API, yet to be vetted.
Example: Usage