tar
Version:
tar for JavaScript
40 lines • 2.51 kB
TypeScript
import { type FileOption, type NoFileOption, type WithAliases } from './dealias.js';
import type { CreateFileHandle, CreateFSSync } from './fs.js';
import type { CreateOptions, CreateOptionsSync } from './options.js';
import { Pack, PackSync, type PackInput, type PackInputSync } from './pack.js';
/**
* Write the chunks to the file, from `position`. Chunks that are
* smaller than 64 KiB are put together for one write.
*/
export declare const writeChunks: (handle: CreateFileHandle, chunks: AsyncIterable<Uint8Array>, position: number) => Promise<void>;
/** The sync form of `writeChunks`. */
export declare const writeChunksSync: (fs: CreateFSSync, fd: number, chunks: Iterable<Uint8Array>, position: number) => void;
/**
* Make the pack for the files of a command. A name that starts with
* `@` is the path of an archive: the pack gets its entries.
*/
export declare const packFiles: (opt: CreateOptions, files: PackInput[]) => Pack;
/** The sync form of `packFiles`. */
export declare const packFilesSync: (opt: CreateOptionsSync, files: PackInputSync[]) => PackSync;
/**
* Make an archive of the files. A directory is added with all that
* is in it. A name that starts with `@` is the path of an archive:
* its entries are added. A file can also be an entry, or a source of
* entries, as in `Pack.add()`.
*
* With `opt.file`, the archive is written to that path through
* `opt.fs`. With no `opt.file`, the result is a stream of the bytes
* of the archive. Files are read only when the stream is read.
*/
export declare function create(opt: WithAliases<CreateOptions> & FileOption, files: PackInput[]): Promise<void>;
export declare function create(opt: WithAliases<CreateOptions> & NoFileOption, files: PackInput[]): ReadableStream<Uint8Array>;
export declare function create(opt: WithAliases<CreateOptions>, files: PackInput[]): Promise<void> | ReadableStream<Uint8Array>;
/**
* The sync form of `create`. With no `opt.file`, the result is an
* iterator of the bytes of the archive. Files are read only when the
* iterator is read.
*/
export declare function createSync(opt: WithAliases<CreateOptionsSync> & FileOption, files: PackInputSync[]): void;
export declare function createSync(opt: WithAliases<CreateOptionsSync> & NoFileOption, files: PackInputSync[]): IterableIterator<Uint8Array, undefined>;
export declare function createSync(opt: WithAliases<CreateOptionsSync>, files: PackInputSync[]): void | IterableIterator<Uint8Array, undefined>;
//# sourceMappingURL=create.d.ts.map