Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1/**2 * Codes for errors generated within this library3 */4export declare const FlateErrorCode: {5 readonly UnexpectedEOF: 0;6 readonly InvalidBlockType: 1;7 readonly InvalidLengthLiteral: 2;8 readonly InvalidDistance: 3;9 readonly StreamFinished: 4;10 readonly NoStreamHandler: 5;11 readonly InvalidHeader: 6;12 readonly NoCallback: 7;13 readonly InvalidUTF8: 8;14 readonly ExtraFieldTooLong: 9;15 readonly InvalidDate: 10;16 readonly FilenameTooLong: 11;17 readonly StreamFinishing: 12;18 readonly InvalidZipData: 13;19 readonly UnknownCompressionMethod: 14;20};21/**22 * An error generated within this library23 */24export interface FlateError extends Error {25 /**26 * The code associated with this error27 */28 code: number;29}30/**31 * Options for decompressing a DEFLATE stream32 */33export interface InflateStreamOptions {34 /**35 * The dictionary used to compress the original data. If no dictionary was used during compression, this option has no effect.36 *37 * Supplying the wrong dictionary during decompression usually yields corrupt output or causes an invalid distance error.38 */39 dictionary?: Uint8Array;40}41/**42 * Options for decompressing DEFLATE data43 */44export interface InflateOptions<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> extends InflateStreamOptions {45 /**46 * The buffer into which to write the decompressed data. Saves memory if you know the decompressed size in advance.47 *48 * Note that if the decompression result is larger than the size of this buffer, it will be truncated to fit.49 */50 out?: Uint8Array<TArrayBuffer>;51}52/**53 * Options for decompressing a GZIP stream54 */55export interface GunzipStreamOptions extends InflateStreamOptions {56}57/**58 * Options for decompressing GZIP data59 */60export interface GunzipOptions<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> extends InflateStreamOptions {61 /**62 * The buffer into which to write the decompressed data. GZIP already encodes the output size, so providing this doesn't save memory.63 *64 * Note that if the decompression result is larger than the size of this buffer, it will be truncated to fit.65 */66 out?: Uint8Array<TArrayBuffer>;67}68/**69 * Options for decompressing a Zlib stream70 */71export interface UnzlibStreamOptions extends InflateStreamOptions {72}73/**74 * Options for decompressing Zlib data75 */76export interface UnzlibOptions<TArrayBuffer extends ArrayBufferLike = ArrayBufferLike> extends InflateOptions<TArrayBuffer> {77}78/**79 * Options for compressing data into a DEFLATE format80 */81export interface DeflateOptions {82 /**83 * The level of compression to use, ranging from 0-9.84 *85 * 0 will store the data without compression.86 * 1 is fastest but compresses the worst, 9 is slowest but compresses the best.87 * The default level is 6.88 *89 * Typically, binary data benefits much more from higher values than text data.90 * In both cases, higher values usually take disproportionately longer than the reduction in final size that results.91 *92 * For example, a 1 MB text file could:93 * - become 1.01 MB with level 0 in 1ms94 * - become 400 kB with level 1 in 10ms95 * - become 320 kB with level 9 in 100ms96 */97 level?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;98 /**99 * The memory level to use, ranging from 0-12. Increasing this increases speed and compression ratio at the cost of memory.100 *101 * Note that this is exponential: while level 0 uses 8 kB, level 4 uses 128 kB, level 8 uses 2 MB, and level 12 uses 32 MB.102 * It is recommended not to lower the value below 4, since that tends to hurt performance.103 * In addition, values above 8 tend to help very little on most data and can even hurt performance.104 *105 * The default value is automatically determined based on the size of the input data.106 */107 mem?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;108 /**109 * A buffer containing common byte sequences in the input data that can be used to significantly improve compression ratios.110 *111 * Dictionaries should be 32kB or smaller and include strings or byte sequences likely to appear in the input.112 * The decompressor must supply the same dictionary as the compressor to extract the original data.113 *114 * Dictionaries only improve aggregate compression ratio when reused across multiple small inputs. They should typically not be used otherwise.115 *116 * Avoid using dictionaries with GZIP and ZIP to maximize software compatibility.117 */118 dictionary?: Uint8Array;119}120/**121 * Options for compressing data into a GZIP format122 */123export interface GzipOptions extends DeflateOptions {124 /**125 * When the file was last modified. Defaults to the current time.126 * Set this to 0 to avoid revealing a modification date entirely.127 */128 mtime?: Date | string | number;129 /**130 * The filename of the data. If the `gunzip` command is used to decompress the data, it will output a file131 * with this name instead of the name of the compressed file.132 */133 filename?: string;134}135/**136 * Options for compressing data into a Zlib format137 */138export interface ZlibOptions extends DeflateOptions {139}140/**141 * Handler for data (de)compression streams142 * @param data The data output from the stream processor143 * @param final Whether this is the final block144 */145export type FlateStreamHandler = (data: Uint8Array<ArrayBuffer>, final: boolean) => void;146/**147 * Handler for asynchronous data (de)compression streams148 * @param err Any error that occurred149 * @param data The data output from the stream processor150 * @param final Whether this is the final block151 */152export type AsyncFlateStreamHandler = (err: FlateError | null, data: Uint8Array<ArrayBuffer>, final: boolean) => void;153/**154 * Handler for the asynchronous completion of (de)compression for a data chunk155 * @param size The number of bytes that were processed. This is measured in terms of the input156 * (i.e. compressed bytes for decompression, uncompressed bytes for compression.)157 */158export type AsyncFlateDrainHandler = (size: number) => void;159/**160 * Callback for asynchronous (de)compression methods161 * @param err Any error that occurred162 * @param data The resulting data. Only present if `err` is null163 */164export type FlateCallback = (err: FlateError | null, data: Uint8Array<ArrayBuffer>) => void;165interface AsyncOptions {166 /**167 * Whether or not to "consume" the source data. This will make the typed array/buffer you pass in168 * unusable but will increase performance and reduce memory usage.169 */170 consume?: boolean;171}172/**173 * Options for compressing data asynchronously into a DEFLATE format174 */175export interface AsyncDeflateOptions extends DeflateOptions, AsyncOptions {176}177/**178 * Options for decompressing DEFLATE data asynchronously179 */180export interface AsyncInflateOptions extends AsyncOptions, InflateStreamOptions {181 /**182 * The original size of the data. Currently, the asynchronous API disallows183 * writing into a buffer you provide; the best you can do is provide the184 * size in bytes and be given back a new typed array.185 */186 size?: number;187}188/**189 * Options for compressing data asynchronously into a GZIP format190 */191export interface AsyncGzipOptions extends GzipOptions, AsyncOptions {192}193/**194 * Options for decompressing GZIP data asynchronously195 */196export interface AsyncGunzipOptions extends AsyncOptions, InflateStreamOptions {197}198/**199 * Options for compressing data asynchronously into a Zlib format200 */201export interface AsyncZlibOptions extends ZlibOptions, AsyncOptions {202}203/**204 * Options for decompressing Zlib data asynchronously205 */206export interface AsyncUnzlibOptions extends AsyncInflateOptions {207}208/**209 * A terminable compression/decompression process210 */211export interface AsyncTerminable {212 /**213 * Terminates the worker thread immediately. The callback will not be called.214 */215 (): void;216}217/**218 * Streaming DEFLATE compression219 */220export declare class Deflate {221 /**222 * Creates a DEFLATE stream223 * @param opts The compression options224 * @param cb The callback to call whenever data is deflated225 */226 constructor(opts: DeflateOptions, cb?: FlateStreamHandler);227 /**228 * Creates a DEFLATE stream229 * @param cb The callback to call whenever data is deflated230 */231 constructor(cb?: FlateStreamHandler);232 private b;233 private s;234 private o;235 /**236 * The handler to call whenever data is available237 */238 ondata: FlateStreamHandler;239 private p;240 /**241 * Pushes a chunk to be deflated242 * @param chunk The chunk to push243 * @param final Whether this is the last chunk244 */245 push(chunk: Uint8Array, final?: boolean): void;246 /**247 * Flushes buffered uncompressed data. Useful to immediately retrieve the248 * deflated output for small inputs.249 * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5250 * extra bytes, but guarantees all pushed data is immediately251 * decompressible. A separate DEFLATE stream may be concatenated252 * with the current output after a sync flush.253 */254 flush(sync?: boolean): void;255}256/**257 * Asynchronous streaming DEFLATE compression258 */259export declare class AsyncDeflate {260 /**261 * The handler to call whenever data is available262 */263 ondata: AsyncFlateStreamHandler;264 /**265 * The handler to call whenever buffered source data is processed (i.e. `queuedSize` updates)266 */267 ondrain?: AsyncFlateDrainHandler;268 /**269 * The number of uncompressed bytes buffered in the stream270 */271 queuedSize: number;272 /**273 * Creates an asynchronous DEFLATE stream274 * @param opts The compression options275 * @param cb The callback to call whenever data is deflated276 */277 constructor(opts: DeflateOptions, cb?: AsyncFlateStreamHandler);278 /**279 * Creates an asynchronous DEFLATE stream280 * @param cb The callback to call whenever data is deflated281 */282 constructor(cb?: AsyncFlateStreamHandler);283 /**284 * Pushes a chunk to be deflated285 * @param chunk The chunk to push286 * @param final Whether this is the last chunk287 */288 push(chunk: Uint8Array, final?: boolean): void;289 /**290 * Flushes buffered uncompressed data. Useful to immediately retrieve the291 * deflated output for small inputs.292 * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5293 * extra bytes, but guarantees all pushed data is immediately294 * decompressible. A separate DEFLATE stream may be concatenated295 * with the current output after a sync flush.296 */297 flush(sync?: boolean): void;298 /**299 * A method to terminate the stream's internal worker. Subsequent calls to300 * push() will silently fail.301 */302 terminate: AsyncTerminable;303}304/**305 * Asynchronously compresses data with DEFLATE without any wrapper306 * @param data The data to compress307 * @param opts The compression options308 * @param cb The function to be called upon compression completion309 * @returns A function that can be used to immediately terminate the compression310 */311export declare function deflate(data: Uint8Array, opts: AsyncDeflateOptions, cb: FlateCallback): AsyncTerminable;312/**313 * Asynchronously compresses data with DEFLATE without any wrapper314 * @param data The data to compress315 * @param cb The function to be called upon compression completion316 */317export declare function deflate(data: Uint8Array, cb: FlateCallback): AsyncTerminable;318/**319 * Compresses data with DEFLATE without any wrapper320 * @param data The data to compress321 * @param opts The compression options322 * @returns The deflated version of the data323 */324export declare function deflateSync(data: Uint8Array, opts?: DeflateOptions): Uint8Array<ArrayBuffer>;325/**326 * Streaming DEFLATE decompression327 */328export declare class Inflate {329 private s;330 private o;331 private p;332 private d;333 /**334 * The handler to call whenever data is available335 */336 ondata: FlateStreamHandler;337 /**338 * Creates a DEFLATE decompression stream339 * @param opts The decompression options340 * @param cb The callback to call whenever data is inflated341 */342 constructor(opts: InflateStreamOptions, cb?: FlateStreamHandler);343 /**344 * Creates a DEFLATE decompression stream345 * @param cb The callback to call whenever data is inflated346 */347 constructor(cb?: FlateStreamHandler);348 private e;349 private c;350 /**351 * Pushes a chunk to be inflated352 * @param chunk The chunk to push353 * @param final Whether this is the final chunk354 */355 push(chunk: Uint8Array, final?: boolean): void;356}357/**358 * Asynchronous streaming DEFLATE decompression359 */360export declare class AsyncInflate {361 /**362 * The handler to call whenever data is available363 */364 ondata: AsyncFlateStreamHandler;365 /**366 * The handler to call whenever buffered source data is processed (i.e. `queuedSize` updates)367 */368 ondrain?: AsyncFlateDrainHandler;369 /**370 * The number of compressed bytes buffered in the stream371 */372 queuedSize: number;373 /**374 * Creates an asynchronous DEFLATE decompression stream375 * @param opts The decompression options376 * @param cb The callback to call whenever data is inflated377 */378 constructor(opts: InflateStreamOptions, cb?: AsyncFlateStreamHandler);379 /**380 * Creates an asynchronous DEFLATE decompression stream381 * @param cb The callback to call whenever data is inflated382 */383 constructor(cb?: AsyncFlateStreamHandler);384 /**385 * Pushes a chunk to be inflated386 * @param chunk The chunk to push387 * @param final Whether this is the last chunk388 */389 push(chunk: Uint8Array, final?: boolean): void;390 /**391 * A method to terminate the stream's internal worker. Subsequent calls to392 * push() will silently fail.393 */394 terminate: AsyncTerminable;395}396/**397 * Asynchronously expands DEFLATE data with no wrapper398 * @param data The data to decompress399 * @param opts The decompression options400 * @param cb The function to be called upon decompression completion401 * @returns A function that can be used to immediately terminate the decompression402 */403export declare function inflate(data: Uint8Array, opts: AsyncInflateOptions, cb: FlateCallback): AsyncTerminable;404/**405 * Asynchronously expands DEFLATE data with no wrapper406 * @param data The data to decompress407 * @param cb The function to be called upon decompression completion408 * @returns A function that can be used to immediately terminate the decompression409 */410export declare function inflate(data: Uint8Array, cb: FlateCallback): AsyncTerminable;411/**412 * Expands DEFLATE data with no wrapper413 * @param data The data to decompress414 * @returns The decompressed version of the data415 */416export declare function inflateSync(data: Uint8Array): Uint8Array<ArrayBuffer>;417/**418 * Expands DEFLATE data with no wrapper419 * @param data The data to decompress420 * @param opts The decompression options421 * @returns The decompressed version of the data422 */423export declare function inflateSync<TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(data: Uint8Array, opts?: InflateOptions<TArrayBuffer>): Uint8Array<TArrayBuffer>;424/**425 * Streaming GZIP compression426 */427export declare class Gzip {428 private c;429 private l;430 private v;431 private o;432 private s;433 /**434 * The handler to call whenever data is available435 */436 ondata: FlateStreamHandler;437 /**438 * Creates a GZIP stream439 * @param opts The compression options440 * @param cb The callback to call whenever data is deflated441 */442 constructor(opts: GzipOptions, cb?: FlateStreamHandler);443 /**444 * Creates a GZIP stream445 * @param cb The callback to call whenever data is deflated446 */447 constructor(cb?: FlateStreamHandler);448 /**449 * Pushes a chunk to be GZIPped450 * @param chunk The chunk to push451 * @param final Whether this is the last chunk452 */453 push(chunk: Uint8Array, final?: boolean): void;454 private p;455 /**456 * Flushes buffered uncompressed data. Useful to immediately retrieve the457 * GZIPped output for small inputs.458 * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5459 * extra bytes, but guarantees all pushed data is immediately460 * decompressible.461 */462 flush(sync?: boolean): void;463}464/**465 * Asynchronous streaming GZIP compression466 */467export declare class AsyncGzip {468 /**469 * The handler to call whenever data is available470 */471 ondata: AsyncFlateStreamHandler;472 /**473 * The handler to call whenever buffered source data is processed (i.e. `queuedSize` updates)474 */475 ondrain?: AsyncFlateDrainHandler;476 /**477 * The number of uncompressed bytes buffered in the stream478 */479 queuedSize: number;480 /**481 * Creates an asynchronous GZIP stream482 * @param opts The compression options483 * @param cb The callback to call whenever data is deflated484 */485 constructor(opts: GzipOptions, cb?: AsyncFlateStreamHandler);486 /**487 * Creates an asynchronous GZIP stream488 * @param cb The callback to call whenever data is deflated489 */490 constructor(cb?: AsyncFlateStreamHandler);491 /**492 * Pushes a chunk to be GZIPped493 * @param chunk The chunk to push494 * @param final Whether this is the last chunk495 */496 push(chunk: Uint8Array, final?: boolean): void;497 /**498 * Flushes buffered uncompressed data. Useful to immediately retrieve the499 * GZIPped output for small inputs.500 * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5501 * extra bytes, but guarantees all pushed data is immediately502 * decompressible.503 */504 flush(sync?: boolean): void;505 /**506 * A method to terminate the stream's internal worker. Subsequent calls to507 * push() will silently fail.508 */509 terminate: AsyncTerminable;510}511/**512 * Asynchronously compresses data with GZIP513 * @param data The data to compress514 * @param opts The compression options515 * @param cb The function to be called upon compression completion516 * @returns A function that can be used to immediately terminate the compression517 */518export declare function gzip(data: Uint8Array, opts: AsyncGzipOptions, cb: FlateCallback): AsyncTerminable;519/**520 * Asynchronously compresses data with GZIP521 * @param data The data to compress522 * @param cb The function to be called upon compression completion523 * @returns A function that can be used to immediately terminate the decompression524 */525export declare function gzip(data: Uint8Array, cb: FlateCallback): AsyncTerminable;526/**527 * Compresses data with GZIP528 * @param data The data to compress529 * @param opts The compression options530 * @returns The gzipped version of the data531 */532export declare function gzipSync(data: Uint8Array, opts?: GzipOptions): Uint8Array<ArrayBuffer>;533/**534 * Handler for new GZIP members in concatenated GZIP streams. Useful for building indices used to perform random-access reads on compressed files.535 * @param offset The offset of the new member relative to the start of the stream536 */537export type GunzipMemberHandler = (offset: number) => void;538/**539 * Streaming single or multi-member GZIP decompression540 */541export declare class Gunzip {542 private v;543 private r;544 private o;545 private p;546 private s;547 /**548 * The handler to call whenever data is available549 */550 ondata: FlateStreamHandler;551 /**552 * The handler to call whenever a new GZIP member is found553 */554 onmember?: GunzipMemberHandler;555 /**556 * Creates a GUNZIP stream557 * @param opts The decompression options558 * @param cb The callback to call whenever data is inflated559 */560 constructor(opts: GunzipStreamOptions, cb?: FlateStreamHandler);561 /**562 * Creates a GUNZIP stream563 * @param cb The callback to call whenever data is inflated564 */565 constructor(cb?: FlateStreamHandler);566 /**567 * Pushes a chunk to be GUNZIPped568 * @param chunk The chunk to push569 * @param final Whether this is the last chunk570 */571 push(chunk: Uint8Array, final?: boolean): void;572}573/**574 * Asynchronous streaming single or multi-member GZIP decompression575 */576export declare class AsyncGunzip {577 /**578 * The handler to call whenever data is available579 */580 ondata: AsyncFlateStreamHandler;581 /**582 * The handler to call whenever buffered source data is processed (i.e. `queuedSize` updates)583 */584 ondrain?: AsyncFlateDrainHandler;585 /**586 * The number of compressed bytes buffered in the stream587 */588 queuedSize: number;589 /**590 * The handler to call whenever a new GZIP member is found591 */592 onmember?: GunzipMemberHandler;593 /**594 * Creates an asynchronous GUNZIP stream595 * @param opts The decompression options596 * @param cb The callback to call whenever data is inflated597 */598 constructor(opts: GunzipStreamOptions, cb?: AsyncFlateStreamHandler);599 /**600 * Creates an asynchronous GUNZIP stream601 * @param cb The callback to call whenever data is inflated602 */603 constructor(cb?: AsyncFlateStreamHandler);604 /**605 * Pushes a chunk to be GUNZIPped606 * @param chunk The chunk to push607 * @param final Whether this is the last chunk608 */609 push(chunk: Uint8Array, final?: boolean): void;610 /**611 * A method to terminate the stream's internal worker. Subsequent calls to612 * push() will silently fail.613 */614 terminate: AsyncTerminable;615}616/**617 * Asynchronously expands GZIP data618 * @param data The data to decompress619 * @param opts The decompression options620 * @param cb The function to be called upon decompression completion621 * @returns A function that can be used to immediately terminate the decompression622 */623export declare function gunzip(data: Uint8Array, opts: AsyncGunzipOptions, cb: FlateCallback): AsyncTerminable;624/**625 * Asynchronously expands GZIP data626 * @param data The data to decompress627 * @param cb The function to be called upon decompression completion628 * @returns A function that can be used to immediately terminate the decompression629 */630export declare function gunzip(data: Uint8Array, cb: FlateCallback): AsyncTerminable;631/**632 * Expands GZIP data633 * @param data The data to decompress634 * @returns The decompressed version of the data635 */636export declare function gunzipSync(data: Uint8Array): Uint8Array<ArrayBuffer>;637/**638 * Expands GZIP data639 * @param data The data to decompress640 * @param opts The decompression options641 * @returns The decompressed version of the data642 */643export declare function gunzipSync<TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(data: Uint8Array, opts?: GunzipOptions<TArrayBuffer>): Uint8Array<TArrayBuffer>;644/**645 * Streaming Zlib compression646 */647export declare class Zlib {648 private c;649 private v;650 private o;651 private s;652 /**653 * The handler to call whenever data is available654 */655 ondata: FlateStreamHandler;656 /**657 * Creates a Zlib stream658 * @param opts The compression options659 * @param cb The callback to call whenever data is deflated660 */661 constructor(opts: ZlibOptions, cb?: FlateStreamHandler);662 /**663 * Creates a Zlib stream664 * @param cb The callback to call whenever data is deflated665 */666 constructor(cb?: FlateStreamHandler);667 /**668 * Pushes a chunk to be zlibbed669 * @param chunk The chunk to push670 * @param final Whether this is the last chunk671 */672 push(chunk: Uint8Array, final?: boolean): void;673 private p;674 /**675 * Flushes buffered uncompressed data. Useful to immediately retrieve the676 * zlibbed output for small inputs.677 * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5678 * extra bytes, but guarantees all pushed data is immediately679 * decompressible.680 */681 flush(sync?: boolean): void;682}683/**684 * Asynchronous streaming Zlib compression685 */686export declare class AsyncZlib {687 /**688 * The handler to call whenever data is available689 */690 ondata: AsyncFlateStreamHandler;691 /**692 * The handler to call whenever buffered source data is processed (i.e. `queuedSize` updates)693 */694 ondrain?: AsyncFlateDrainHandler;695 /**696 * The number of uncompressed bytes buffered in the stream697 */698 queuedSize: number;699 /**700 * Creates an asynchronous Zlib stream701 * @param opts The compression options702 * @param cb The callback to call whenever data is deflated703 */704 constructor(opts: ZlibOptions, cb?: AsyncFlateStreamHandler);705 /**706 * Creates an asynchronous Zlib stream707 * @param cb The callback to call whenever data is deflated708 */709 constructor(cb?: AsyncFlateStreamHandler);710 /**711 * Pushes a chunk to be deflated712 * @param chunk The chunk to push713 * @param final Whether this is the last chunk714 */715 push(chunk: Uint8Array, final?: boolean): void;716 /**717 * Flushes buffered uncompressed data. Useful to immediately retrieve the718 * zlibbed output for small inputs.719 * @param sync Whether to flush to a byte boundary. A sync flush takes 4-5720 * extra bytes, but guarantees all pushed data is immediately721 * decompressible.722 */723 flush(sync?: boolean): void;724 /**725 * A method to terminate the stream's internal worker. Subsequent calls to726 * push() will silently fail.727 */728 terminate: AsyncTerminable;729}730/**731 * Asynchronously compresses data with Zlib732 * @param data The data to compress733 * @param opts The compression options734 * @param cb The function to be called upon compression completion735 */736export declare function zlib(data: Uint8Array, opts: AsyncZlibOptions, cb: FlateCallback): AsyncTerminable;737/**738 * Asynchronously compresses data with Zlib739 * @param data The data to compress740 * @param cb The function to be called upon compression completion741 * @returns A function that can be used to immediately terminate the compression742 */743export declare function zlib(data: Uint8Array, cb: FlateCallback): AsyncTerminable;744/**745 * Compress data with Zlib746 * @param data The data to compress747 * @param opts The compression options748 * @returns The zlib-compressed version of the data749 */750export declare function zlibSync(data: Uint8Array, opts?: ZlibOptions): Uint8Array<ArrayBuffer>;751/**752 * Streaming Zlib decompression753 */754export declare class Unzlib {755 private v;756 private p;757 /**758 * The handler to call whenever data is available759 */760 ondata: FlateStreamHandler;761 /**762 * Creates a Zlib decompression stream763 * @param opts The decompression options764 * @param cb The callback to call whenever data is inflated765 */766 constructor(opts: UnzlibStreamOptions, cb?: FlateStreamHandler);767 /**768 * Creates a Zlib decompression stream769 * @param cb The callback to call whenever data is inflated770 */771 constructor(cb?: FlateStreamHandler);772 /**773 * Pushes a chunk to be unzlibbed774 * @param chunk The chunk to push775 * @param final Whether this is the last chunk776 */777 push(chunk: Uint8Array, final?: boolean): void;778}779/**780 * Asynchronous streaming Zlib decompression781 */782export declare class AsyncUnzlib {783 /**784 * The handler to call whenever data is available785 */786 ondata: AsyncFlateStreamHandler;787 /**788 * The handler to call whenever buffered source data is processed (i.e. `queuedSize` updates)789 */790 ondrain?: AsyncFlateDrainHandler;791 /**792 * The number of compressed bytes buffered in the stream793 */794 queuedSize: number;795 /**796 * Creates an asynchronous Zlib decompression stream797 * @param opts The decompression options798 * @param cb The callback to call whenever data is inflated799 */800 constructor(opts: UnzlibStreamOptions, cb?: AsyncFlateStreamHandler);801 /**802 * Creates an asynchronous Zlib decompression stream803 * @param cb The callback to call whenever data is inflated804 */805 constructor(cb?: AsyncFlateStreamHandler);806 /**807 * Pushes a chunk to be decompressed from Zlib808 * @param chunk The chunk to push809 * @param final Whether this is the last chunk810 */811 push(chunk: Uint8Array, final?: boolean): void;812 /**813 * A method to terminate the stream's internal worker. Subsequent calls to814 * push() will silently fail.815 */816 terminate: AsyncTerminable;817}818/**819 * Asynchronously expands Zlib data820 * @param data The data to decompress821 * @param opts The decompression options822 * @param cb The function to be called upon decompression completion823 * @returns A function that can be used to immediately terminate the decompression824 */825export declare function unzlib(data: Uint8Array, opts: AsyncUnzlibOptions, cb: FlateCallback): AsyncTerminable;826/**827 * Asynchronously expands Zlib data828 * @param data The data to decompress829 * @param cb The function to be called upon decompression completion830 * @returns A function that can be used to immediately terminate the decompression831 */832export declare function unzlib(data: Uint8Array, cb: FlateCallback): AsyncTerminable;833/**834 * Expands Zlib data835 * @param data The data to decompress836 * @returns The decompressed version of the data837 */838export declare function unzlibSync(data: Uint8Array): Uint8Array<ArrayBuffer>;839/**840 * Expands Zlib data841 * @param data The data to decompress842 * @param opts The decompression options843 * @returns The decompressed version of the data844 */845export declare function unzlibSync<TArrayBuffer extends ArrayBufferLike = ArrayBuffer>(data: Uint8Array, opts?: UnzlibOptions<TArrayBuffer>): Uint8Array<TArrayBuffer>;846export { gzip as compress, AsyncGzip as AsyncCompress };847export { gzipSync as compressSync, Gzip as Compress };848/**849 * Streaming GZIP, Zlib, or raw DEFLATE decompression850 */851export declare class Decompress {852 private G;853 private I;854 private Z;855 private o;856 private s;857 private p;858 /**859 * The handler to call whenever data is available860 */861 ondata: FlateStreamHandler;862 /**863 * Creates a decompression stream864 * @param opts The decompression options865 * @param cb The callback to call whenever data is decompressed866 */867 constructor(opts: InflateStreamOptions, cb?: FlateStreamHandler);868 /**869 * Creates a decompression stream870 * @param cb The callback to call whenever data is decompressed871 */872 constructor(cb?: FlateStreamHandler);873 private i;874 /**875 * Pushes a chunk to be decompressed876 * @param chunk The chunk to push877 * @param final Whether this is the last chunk878 */879 push(chunk: Uint8Array, final?: boolean): void;880}881/**882 * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression883 */884export declare class AsyncDecompress {885 private G;886 private I;887 private Z;888 /**889 * The handler to call whenever data is available890 */891 ondata: AsyncFlateStreamHandler;892 /**893 * The handler to call whenever buffered source data is processed (i.e. `queuedSize` updates)894 */895 ondrain?: AsyncFlateDrainHandler;896 /**897 * The number of compressed bytes buffered in the stream898 */899 queuedSize: number;900 /**901 * Creates an asynchronous decompression stream902 * @param opts The decompression options903 * @param cb The callback to call whenever data is decompressed904 */905 constructor(opts: InflateStreamOptions, cb?: AsyncFlateStreamHandler);906 /**907 * Creates an asynchronous decompression stream908 * @param cb The callback to call whenever data is decompressed909 */910 constructor(cb?: AsyncFlateStreamHandler);911 private i;912 /**913 * Pushes a chunk to be decompressed914 * @param chunk The chunk to push915 * @param final Whether this is the last chunk916 */917 push(chunk: Uint8Array, final?: boolean): void;918}919/**920 * Asynchrononously expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format921 * @param data The data to decompress922 * @param opts The decompression options923 * @param cb The function to be called upon decompression completion924 * @returns A function that can be used to immediately terminate the decompression925 */926export declare function decompress(data: Uint8Array, opts: AsyncInflateOptions, cb: FlateCallback): AsyncTerminable;927/**928 * Asynchrononously expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format929 * @param data The data to decompress930 * @param cb The function to be called upon decompression completion931 * @returns A function that can be used to immediately terminate the decompression932 */933export declare function decompress(data: Uint8Array, cb: FlateCallback): AsyncTerminable;934/**935 * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format936 * @param data The data to decompress937 * @param opts The decompression options938 * @returns The decompressed version of the data939 */940export declare function decompressSync(data: Uint8Array, opts?: InflateOptions): Uint8Array<ArrayBufferLike>;941/**942 * Attributes for files added to a ZIP archive object943 */944export interface ZipAttributes {945 /**946 * The operating system of origin for this file. The value is defined947 * by PKZIP's APPNOTE.txt, section 4.4.2.2. For example, 0 (the default)948 * is MS/DOS, 3 is Unix, 19 is macOS.949 */950 os?: number;951 /**952 * The file's attributes. These are traditionally somewhat complicated953 * and platform-dependent, so using them is scarcely necessary. However,954 * here is a representation of what this is, bit by bit:955 *956 * `TTTTugtrwxrwxrwx0000000000ADVSHR`957 *958 * TTTT = file type (rarely useful)959 *960 * u = setuid, g = setgid, t = sticky961 *962 * rwx = user permissions, rwx = group permissions, rwx = other permissions963 *964 * 0000000000 = unused965 *966 * A = archive, D = directory, V = volume label, S = system file, H = hidden, R = read-only967 *968 * If you want to set the Unix permissions, for instance, just bit shift by 16, e.g. 0o644 << 16.969 * Note that attributes usually only work in conjunction with the `os` setting: you must use970 * `os` = 3 (Unix) if you want to set Unix permissions971 */972 attrs?: number;973 /**974 * Extra metadata to add to the file. This field is defined by PKZIP's APPNOTE.txt,975 * section 4.4.28. At most 65,535 bytes may be used in each ID. The ID must be an976 * integer between 0 and 65,535, inclusive.977 *978 * This field is incredibly rare and almost never needed except for compliance with979 * proprietary standards and software.980 */981 extra?: Record<number, Uint8Array>;982 /**983 * The comment to attach to the file. This field is defined by PKZIP's APPNOTE.txt,984 * section 4.4.26. The comment must be at most 65,535 bytes long UTF-8 encoded. This985 * field is not read by consumer software.986 */987 comment?: string;988 /**989 * When the file was last modified. Defaults to the current time.990 */991 mtime?: GzipOptions['mtime'];992}993/**994 * Options for creating a ZIP archive995 */996export interface ZipOptions extends DeflateOptions, ZipAttributes {997}998/**999 * Options for expanding a ZIP archive1000 */1001export interface UnzipOptions {1002 /**1003 * A filter function to extract only certain files from a ZIP archive1004 */1005 filter?: UnzipFileFilter;1006}1007/**1008 * Options for asynchronously creating a ZIP archive1009 */1010export interface AsyncZipOptions extends AsyncDeflateOptions, ZipAttributes {1011}1012/**1013 * Options for asynchronously expanding a ZIP archive1014 */1015export interface AsyncUnzipOptions extends UnzipOptions {1016}1017/**1018 * A file that can be used to create a ZIP archive1019 */1020export type ZippableFile = Uint8Array | Zippable | [Uint8Array | Zippable, ZipOptions];1021/**1022 * A file that can be used to asynchronously create a ZIP archive1023 */1024export type AsyncZippableFile = Uint8Array | AsyncZippable | [Uint8Array | AsyncZippable, AsyncZipOptions];1025/**1026 * The complete directory structure of a ZIPpable archive1027 */1028export interface Zippable {1029 [path: string]: ZippableFile;1030}1031/**1032 * The complete directory structure of an asynchronously ZIPpable archive1033 */1034export interface AsyncZippable {1035 [path: string]: AsyncZippableFile;1036}1037/**1038 * An unzipped archive. The full path of each file is used as the key,1039 * and the file is the value1040 */1041export interface Unzipped {1042 [path: string]: Uint8Array<ArrayBuffer>;1043}1044/**1045 * Handler for string generation streams1046 * @param data The string output from the stream processor1047 * @param final Whether this is the final block1048 */1049export type StringStreamHandler = (data: string, final: boolean) => void;1050/**1051 * Callback for asynchronous ZIP decompression1052 * @param err Any error that occurred1053 * @param data The decompressed ZIP archive1054 */1055export type UnzipCallback = (err: FlateError | null, data: Unzipped) => void;1056/**1057 * Handler for streaming ZIP decompression1058 * @param file The file that was found in the archive1059 */1060export type UnzipFileHandler = (file: UnzipFile) => void;1061/**1062 * Streaming UTF-8 decoding1063 */1064export declare class DecodeUTF8 {1065 private p;1066 private t;1067 /**1068 * Creates a UTF-8 decoding stream1069 * @param cb The callback to call whenever data is decoded1070 */1071 constructor(cb?: StringStreamHandler);1072 /**1073 * Pushes a chunk to be decoded from UTF-8 binary1074 * @param chunk The chunk to push1075 * @param final Whether this is the last chunk1076 */1077 push(chunk: Uint8Array, final?: boolean): void;1078 /**1079 * The handler to call whenever data is available1080 */1081 ondata: StringStreamHandler;1082}1083/**1084 * Streaming UTF-8 encoding1085 */1086export declare class EncodeUTF8 {1087 private d;1088 /**1089 * Creates a UTF-8 decoding stream1090 * @param cb The callback to call whenever data is encoded1091 */1092 constructor(cb?: FlateStreamHandler);1093 /**1094 * Pushes a chunk to be encoded to UTF-81095 * @param chunk The string data to push1096 * @param final Whether this is the last chunk1097 */1098 push(chunk: string, final?: boolean): void;1099 /**1100 * The handler to call whenever data is available1101 */1102 ondata: FlateStreamHandler;1103}1104/**1105 * Converts a string into a Uint8Array for use with compression/decompression methods1106 * @param str The string to encode1107 * @param latin1 Whether or not to interpret the data as Latin-1. This should1108 * not need to be true unless decoding a binary string.1109 * @returns The string encoded in UTF-8/Latin-1 binary1110 */1111export declare function strToU8(str: string, latin1?: boolean): Uint8Array<ArrayBuffer>;1112/**1113 * Converts a Uint8Array to a string1114 * @param dat The data to decode to string1115 * @param latin1 Whether or not to interpret the data as Latin-1. This should1116 * not need to be true unless encoding to binary string.1117 * @returns The original UTF-8/Latin-1 string1118 */1119export declare function strFromU8(dat: Uint8Array, latin1?: boolean): string;1120/**1121 * A stream that can be used to create a file in a ZIP archive1122 */1123export interface ZipInputFile extends ZipAttributes {1124 /**1125 * The filename to associate with the data provided to this stream. If you1126 * want a file in a subdirectory, use forward slashes as a separator (e.g.1127 * `directory/filename.ext`). This will still work on Windows.1128 */1129 filename: string;1130 /**1131 * The size of the file in bytes. This attribute may be invalid after1132 * the file is added to the ZIP archive; it must be correct only before the1133 * stream completes.1134 *1135 * If you don't want to have to compute this yourself, consider extending the1136 * ZipPassThrough class and overriding its process() method, or using one of1137 * ZipDeflate or AsyncZipDeflate.1138 */1139 size: number;1140 /**1141 * A CRC of the original file contents. This attribute may be invalid after1142 * the file is added to the ZIP archive; it must be correct only before the1143 * stream completes.1144 *1145 * If you don't want to have to generate this yourself, consider extending the1146 * ZipPassThrough class and overriding its process() method, or using one of1147 * ZipDeflate or AsyncZipDeflate.1148 */1149 crc: number;1150 /**1151 * The compression format for the data stream. This number is determined by1152 * the spec in PKZIP's APPNOTE.txt, section 4.4.5. For example, 0 = no1153 * compression, 8 = deflate, 14 = LZMA1154 */1155 compression: number;1156 /**1157 * Bits 1 and 2 of the general purpose bit flag, specified in PKZIP's1158 * APPNOTE.txt, section 4.4.4. Should be between 0 and 3. This is unlikely1159 * to be necessary.1160 */1161 flag?: number;1162 /**1163 * The handler to be called when data is added. After passing this stream to1164 * the ZIP file object, this handler will always be defined. To call it:1165 *1166 * `stream.ondata(error, chunk, final)`1167 *1168 * error = any error that occurred (null if there was no error)1169 *1170 * chunk = a Uint8Array of the data that was added (null if there was an1171 * error)1172 *1173 * final = boolean, whether this is the final chunk in the stream1174 */1175 ondata?: AsyncFlateStreamHandler;1176 /**1177 * A method called when the stream is no longer needed, for clean-up1178 * purposes. This will not always be called after the stream completes,1179 * so you may wish to call this.terminate() after the final chunk is1180 * processed if you have clean-up logic.1181 */1182 terminate?: AsyncTerminable;1183}1184/**1185 * A pass-through stream to keep data uncompressed in a ZIP archive.1186 */1187export declare class ZipPassThrough implements ZipInputFile {1188 filename: string;1189 crc: number;1190 size: number;1191 compression: number;1192 os?: number;1193 attrs?: number;1194 comment?: string;1195 extra?: Record<number, Uint8Array>;1196 mtime?: GzipOptions['mtime'];1197 ondata: AsyncFlateStreamHandler;1198 private c;1199 /**1200 * Creates a pass-through stream that can be added to ZIP archives