UNPKG

tar

Version:
38 lines • 1.93 kB
import type { Transform } from 'node:stream'; import * as nodeZlib from 'node:zlib'; import type { Codec, CodecStream } from '../codec.js'; /** * The functions of `node:zlib` that the codecs use. A runtime can * have no brotli functions or no zstd functions. */ export type ZlibModule = Pick<typeof nodeZlib, 'createGzip' | 'createGunzip' | 'gzipSync' | 'gunzipSync'> & Partial<Pick<typeof nodeZlib, 'createBrotliCompress' | 'createBrotliDecompress' | 'brotliCompressSync' | 'brotliDecompressSync' | 'createZstdCompress' | 'createZstdDecompress' | 'zstdCompressSync' | 'zstdDecompressSync'>>; /** * Make the two web streams of a `node:zlib` stream, or of another * `Transform` stream of `node:stream`. The result fits the * `transform` option of `extract`. * * As with a `TransformStream`, a write is complete only when the * reader asks for more output than the stream has. The zlib stream * makes output only until its buffer is full. So the reader of an * archive can stop before more is decompressed. * * @param batch put small chunks of input together for one write. * Each write is a task for a thread. * @param first called with the first chunk of output */ export declare const codecStream: (stream: Transform, batch?: boolean, first?: (chunk: Uint8Array) => void) => CodecStream; /** * The codecs of a `node:zlib` module: gzip, then brotli and zstd if * the module has their functions. * * The value of a `gzip`, `brotli`, or `zstd` option of `create` goes * to the zlib function as its options. A gzip codec reads the tar * option `portable` in its options: it makes output that does not * name the system. * * A brotli archive has no magic number. The readers use the brotli * codec for a file with a name that ends in `.tar.br` or `.tbr`, if * the file does not start with a tar header. */ export declare const zlibCodecs: (z?: ZlibModule) => Codec[]; //# sourceMappingURL=codecs.d.ts.map