UNPKG

tar

Version:
46 lines • 1.9 kB
import { type Codec } from './codec.js'; import { type WithAliases } from './dealias.js'; import type { ReplaceOptions, ReplaceOptionsSync } from './options.js'; import type { PackInput, PackInputSync } from './pack.js'; /** * Finds the place in an archive file where new entries go: the end * of the last complete entry before the first block that is not a * valid header. A PAX or GNU header with no entry after it is not a * complete entry. * * Read the file into `buf` at `pos`, and call `push()`, until it * returns false. The bodies of the entries are not read. */ export declare class AppendScan { #private; buf: Uint8Array; /** The place in the file of the next read. */ pos: number; /** * @param size the size of the file * @param mtimes gets the path and the `mtime` of each complete entry */ constructor(size: number, codecs?: Codec[], mtimes?: Map<string, Date>); /** The place in the file where new entries go. */ get position(): number; /** The number of bytes to read into `buf` at `pos`. */ get want(): number; /** * Parse the first `length` bytes of `buf`. False if the place is * found. Throws if the file is compressed. */ push(length: number): boolean; } /** * Add the files to the end of an archive file that is not * compressed. The files are the same as for `create`. If the archive * does not exist, it is made. * * The new entries go after the last complete entry of the archive. * A reader of the archive gets the old entry and then the new entry * of a path that is in it two times. */ export declare const replace: (options: WithAliases<ReplaceOptions>, files: PackInput[]) => Promise<void>; /** The sync form of `replace`. */ export declare const replaceSync: (options: WithAliases<ReplaceOptionsSync>, files: PackInputSync[]) => void; //# sourceMappingURL=replace.d.ts.map