import type { ZipStringEncoding } from "../shared/text.js"; import { parseZipExtraFields, type ZipExtraFields, type ZipVars } from "../zip-spec/zip-extra-fields.js"; export declare const CRX_HEADER_FORMAT: [string, number][]; export declare const LOCAL_FILE_HEADER_FORMAT: [string, number][]; export declare const DATA_DESCRIPTOR_FORMAT: [string, number][]; export declare const CENTRAL_DIRECTORY_FILE_HEADER_FORMAT: [string, number][]; export declare const END_OF_CENTRAL_DIRECTORY_FORMAT: [string, number][]; export declare const DATA_DESCRIPTOR_SIGNATURE_BYTES: Uint8Array; export interface ZipEntryVarsMeta { flags: number | null; uncompressedSize: number; lastModifiedDate: number | null; lastModifiedTime: number | null; } export type { ZipVars, ZipExtraFields }; export interface ZipEntryPropsMeta { path: string; pathBuffer: Uint8Array; flags: { isUnicode: boolean; }; } export interface CrxHeader { version: number | null; pubKeyLength: number | null; signatureLength: number | null; publicKey?: Uint8Array; signature?: Uint8Array; } export interface EntryVars { versionsNeededToExtract: number | null; flags: number | null; compressionMethod: number | null; lastModifiedTime: number | null; lastModifiedDate: number | null; crc32: number | null; compressedSize: number | null; uncompressedSize: number | null; fileNameLength: number | null; extraFieldLength: number | null; lastModifiedDateTime?: Date; crxHeader?: CrxHeader; } export interface EntryProps { path: string; pathBuffer: Uint8Array; flags: { isUnicode: boolean; }; } export interface DataDescriptorVars { dataDescriptorSignature: number | null; crc32: number | null; compressedSize: number | null; uncompressedSize: number | null; } export declare function isZipUnicodeFlag(flags: number | null): boolean; export declare function isZipDirectoryPath(path: string): boolean; export { S_IFMT, S_IFLNK, S_IFDIR, ZIP_OS_MSDOS, getUnixModeFromExternalAttributes, getOsFromVersionMadeBy, isSymlinkMode, isDirectoryMode } from "../zip-spec/zip-records.js"; /** * Legacy entry type detection (without symlink support). * * Note: For full symlink detection, use buffer-based parsing via ZipParser * which reads the Central Directory and has access to externalAttributes. */ export declare function getZipEntryType(path: string, uncompressedSize: number): "Directory" | "File"; export declare function buildZipEntryProps(path: string, pathBuffer: Uint8Array, flags: number | null): ZipEntryPropsMeta; export declare function resolveZipEntryLastModifiedDateTime(vars: ZipEntryVarsMeta, extraFields: ZipExtraFields): Date; export declare const parseExtraField: typeof parseZipExtraFields; export declare function hasDataDescriptorFlag(flags: number | null): boolean; export declare function isFileSizeKnown(flags: number | null, compressedSize: number | null): boolean; export type PullFn = (length: number) => Promise; export declare function readCrxHeader(pull: PullFn): Promise; export declare function readLocalFileHeader(pull: PullFn): Promise<{ vars: EntryVars; fileNameBuffer: Uint8Array; extraFieldData: Uint8Array; }>; export declare function readDataDescriptor(pull: PullFn): Promise; export declare function consumeCentralDirectoryFileHeader(pull: PullFn): Promise; export declare function consumeEndOfCentralDirectoryRecord(pull: PullFn): Promise; export declare function isValidZipRecordSignature(sig: number): boolean; export interface ValidatedDataDescriptorScanResult { /** Start index of the descriptor within `view`, or -1 when not found yet. */ foundIndex: number; /** Where the caller should resume searching on the next scan of (a mostly unchanged) view. */ nextSearchFrom: number; } export declare function scanValidatedDataDescriptor(view: Uint8Array, dataDescriptorSignature: Uint8Array, bytesEmitted: number, startIndex?: number, out?: ValidatedDataDescriptorScanResult): ValidatedDataDescriptorScanResult; export interface ParseOptions { verbose?: boolean; forceStream?: boolean; useWorkerInflate?: boolean; workerInflateUrl?: string; inputHighWaterMarkBytes?: number; inputLowWaterMarkBytes?: number; thresholdBytes?: number; /** Optional string encoding for legacy (non-UTF8) names. */ encoding?: ZipStringEncoding; } export interface ParseDriverState { crxHeader?: CrxHeader; reachedCD?: boolean; } export interface ParseCoreIO { pull(length: number): Promise; pullUntil(pattern: Uint8Array, includeEof?: boolean): Promise; setDone(): void; } export interface ParseCoreEmitter { emitCrxHeader(header: CrxHeader): void; emitError(err: Error): void; emitClose(): void; } export type LocalFileRecordHandler = (opts: ParseOptions, io: IO, emitter: Emitter, state: ParseDriverState) => Promise; export declare const DEFAULT_PARSE_THRESHOLD_BYTES: number; export declare function runParseLoopCore(opts: ParseOptions, io: IO, emitter: Emitter, state: ParseDriverState, onLocalFileRecord: LocalFileRecordHandler): Promise;