/** * Compression codecs of JData arrays (_ArrayZipType_): zlib and gzip (Node's zlib, or pako), * lz4/lz4hc (raw LZ4 blocks, as zmat writes them; built in), base64, and any codec registered * with registerCodec (lzma, zstd, blosc2, ... from other libraries); byte shuffling. * * Copyright (c) 2019-2026 Qianqian Fang . BSD 3-clause license. */ export interface Codec { /** compress bytes; opts: {level, ...} */ encode?: (bytes: Uint8Array, opts: any) => Uint8Array; /** decompress bytes; size: the expected size in bytes, when known */ decode: (bytes: Uint8Array, size: number | undefined, opts: any) => Uint8Array; } /** A plain Uint8Array copy of bytes (Node's Buffer.slice gives views into shared memory). */ export declare function own(b: Uint8Array): Uint8Array; export declare function giveAway(b: Uint8Array): Uint8Array; /** Whether b is bytes made here, all of its buffer (and forgets it: it is taken once). */ export declare function takeOwned(b: Uint8Array): boolean; /** Bytes of base64 text (whitespace, padding and the URL alphabet accepted). */ export declare function base64ToBytes(s: string | Uint8Array): Uint8Array; /** Base64 text of bytes. */ export declare function bytesToBase64(b: Uint8Array): string; /** Decompresses a raw LZ4 block (no frame), as zmat's lz4 and lz4hc write. */ export declare function lz4Decode(src: Uint8Array, size?: number): Uint8Array; /** Compresses bytes into a raw LZ4 block (greedy, a 64k-entry hash table, LZ4's skipping). */ export declare function lz4Encode(src: Uint8Array): Uint8Array; /** Groups the k-th bytes of every element of width w together (as Blosc and zmat). */ export declare function shuffle(b: Uint8Array, w: number): Uint8Array; export declare function unshuffle(b: Uint8Array, w: number): Uint8Array; /** The built-in zlib and gzip codecs (the async functions run these on threads). */ export declare const ZLIB_CODEC: Codec; export declare const GZIP_CODEC: Codec; /** Adds or replaces a codec: registerCodec('zstd', {decode: (bytes, size) => ..., encode: ...}). */ export declare function registerCodec(name: string, codec: Codec): void; export declare function getCodec(name: string, extra?: { [name: string]: Codec; }): Codec; /** Whether name is the built-in base64 codec here (not one registered in its place). */ export declare function isBuiltinBase64(name: string, extra?: { [name: string]: Codec; }): boolean; export declare function codecNames(): string[];