/// import { Writable } from 'stream'; /** * Zipper Entry Extra Field. */ export declare class ZipperEntryExtraField extends Object { /** * Type ID. */ type: number; /** * Data for the type. */ data: Buffer | null; constructor(); /** * Encode type and data as buffer. * * @returns Buffer data. */ toBuffer(): Buffer; /** * Init Info-ZIP UNIX type 2 data, local header. * * @param uid User ID. * @param gid Group ID. */ initInfoZipUnix2Local(uid?: number, gid?: number): void; /** * Init Info-ZIP UNIX type 2 data, central header. * * @param uid User ID. * @param gid Group ID. */ initInfoZipUnix2Central(uid?: number, gid?: number): void; /** * Init Extended Timestamp data, local header. * * @param mtime Modification time. * @param atime Access time. * @param ctime Creation time. */ initExtendedTimestampLocal(mtime?: Readonly | number | null, atime?: Readonly | number | null, ctime?: Readonly | number | null): void; /** * Init Extended Timestamp data, central header. * * @param mtime Modification time. * @param atime Access time. * @param ctime Creation time. */ initExtendedTimestampCentral(mtime?: Readonly | number | null, atime?: Readonly | number | null, ctime?: Readonly | number | null): void; /** * Init Info-ZIP UNIX type 2 data. * * @param local Local header or central. * @param uid User ID. * @param gid Group ID. */ protected _initInfoZipUnix2(local: boolean, uid: number, gid: number): void; /** * Init Extended Timestamp data. * * @param local Local header or central. * @param mtime Modification time. * @param atime Access time. * @param ctime Creation time. */ protected _initExtendedTimestamp(local: boolean, mtime: Readonly | number | null, atime: Readonly | number | null, ctime: Readonly | number | null): void; } /** * Zipper Entry. */ export declare class ZipperEntry extends Object { /** * Tag signature, local header. */ signatureLocal: number; /** * Tag signature, central header. */ signatureCentral: number; /** * Extract version. */ extractVersion: number; /** * Extract host OS. */ extractHostOS: number; /** * Create version. */ createVersion: number; /** * Create host OS. */ createHostOS: number; /** * Extract flags. */ flags: number; /** * Compression type. */ compression: number; /** * DOS time. */ time: number; /** * DOS date. */ date: number; /** * Data CRC32. */ crc32: number; /** * Size compressed. */ sizeCompressed: number; /** * Size uncompressed. */ sizeUncompressed: number; /** * Disk number start. */ diskNumberStart: number; /** * Internal attributes. */ internalAttributes: number; /** * External attributes. */ externalAttributes: number; /** * Header offset, local header. */ headerOffsetLocal: number; /** * Entry path. */ path: string; /** * Entry comment. */ comment: string; /** * Extra fields, local header. */ extraFieldsLocal: ZipperEntryExtraField[]; /** * Extra fields, central header. */ extraFieldsCentral: ZipperEntryExtraField[]; constructor(); /** * Create new ZipperEntryExtraField object. * * @returns ZipperEntryExtraField object. */ createExtraField(): ZipperEntryExtraField; /** * Set date from a date object or timestamp. * * @param date Date object or timestamp. */ setDate(date: Readonly | number): void; /** * Get path as data. * * @returns Path as data buffer. */ getPathBuffer(): Buffer; /** * Get comment as data. * * @returns Comment as data buffer. */ getCommentBuffer(): Buffer; /** * Get the file record extra fields as data. * * @returns Extra fields as data. */ getExtraFieldsLocalBuffer(): Buffer; /** * Get the director entry extra fields as data. * * @returns Extra fields as data. */ getExtraFieldsCentralBuffer(): Buffer; /** * Get file record data. * * @returns File record data. */ getLocalBuffer(): Buffer; /** * Get directory entry data. * * @returns Directory entry data. */ getCentralBuffer(): Buffer; /** * Setup data for entry. * * @param data Data for the entry. * @param compress Compress option, true to force, false to disable. * @returns Resulting data, or null if no data passed. */ initData(data: Readonly | null, compress?: boolean | null): Promise | null>; /** * Add extra fields for Extended Timestamp. * * @param mtime Modification time. * @param atime Access time. * @param ctime Creation time. */ addExtraFieldsExtendedTimestamp(mtime?: Readonly | number | null, atime?: Readonly | number | null, ctime?: Readonly | number | null): void; /** * Add extra fields for Info-ZIP UNIX type 2. * * @param uid User ID. * @param gid Group ID. */ addExtraFieldsInfoZipUnix2(uid?: number, gid?: number): void; /** * Convert date from a date object or timestamp. * * @param date Date object or timestamp. * @returns DOS time. */ protected _dateToDosTime(date: Readonly | number): { date: number; time: number; }; /** * Calculate the CRC32 hash for data. * * @param data Data to be hashed. * @returns CRC32 hash. */ protected _bufferCrc32(data: Readonly): number; /** * Zlib deflate raw data. * * @param data Data to be compressed. * @returns Compressed data. */ protected _zlibDeflateRaw(data: Readonly): Promise; } /** * Zipper, a low-level ZIP file writter. * * @param output Writable stream. */ export declare class Zipper extends Object { /** * Tag signature. */ signature: number; /** * Archive comment. */ comment: string; /** * Added entries. */ entries: ZipperEntry[]; /** * Current offset. */ protected _offset: number; /** * Output stream. */ protected readonly _output: Writable; constructor(output: Writable); /** * Create new ZipperEntry object. * * @returns ZipperEntry object. */ createEntry(): ZipperEntry; /** * Get comment as data. * * @returns Comment data. */ getCommentBuffer(): Buffer; /** * Get directory buffer data. * * @returns Directory data. */ getDirectoryBuffer(): Buffer; /** * Add Entry and any associated data. * * @param entry Entry object. * @param data Data from the entry initData method. */ addEntry(entry: ZipperEntry, data?: Readonly | null): Promise; /** * Close stream. */ close(): Promise; /** * Write data buffer to output stream. * * @param data Data buffer. */ protected _writeOutput(data: Readonly): Promise; }