/** Zip plumbing shared by every portable artifact in this library. * * Everything serializes to a flat `Map` first — that map can be * zipped, written to OPFS, uploaded, or nested inside a bigger archive under * a prefix. Binary stays binary the whole way: a Float32 vector costs 4 bytes * per dimension here, versus ~10 as a JSON number. */ /** A zip implementation. fflate's `zip`/`unzip` match this shape. */ export interface ZipLike { zip: (files: Record, opts: Record, cb: (err: Error | null, data: Uint8Array) => void) => void; unzip: (data: Uint8Array, cb: (err: Error | null, files: Record) => void) => void; } export interface ZipOptions { /** Inject fflate (or anything with the same zip/unzip shape). Defaults to CDN. */ zip?: ZipLike; /** Deflate level 0-9. Default 0 — model weights and vectors are already * dense, so compressing them burns CPU for almost nothing. Raise it for * text-heavy archives. */ level?: number; } /** Anything you can hand to an importer: bytes, a fetched buffer, a File from * an , or a URL to fetch. */ export type ArchiveSource = Uint8Array | ArrayBuffer | Blob | string; export declare const encodeJSON: (v: unknown) => Uint8Array; export declare const decodeJSON: (b: Uint8Array) => T; /** Read `source` into bytes — fetching it first when given a URL. */ export declare function readSource(source: ArchiveSource): Promise; export declare function filesToZip(files: Map, opts?: ZipOptions): Promise; export declare function filesFromZip(source: ArchiveSource, opts?: ZipOptions): Promise>; /** Nest a file map under a prefix (used to compose artifacts into one archive). */ export declare function prefixFiles(files: Map, prefix: string): Map; /** Pull one nested artifact back out of a composed archive. */ export declare function stripPrefix(files: Map, prefix: string): Map; export declare function requireFile(files: Map, name: string): Uint8Array;