/** * Sync snapshots of async-bodied web types (`Request`, `Response`, `Blob`, * `File`) after their bodies have been drained. msgpackr's extension `write` * callback is synchronous, so anything with an async body must be pre-processed * into one of these before packing. */ /** * `Uint8Array` — the shape `BodyInit`/`BlobPart` expect under DOM * lib. */ type Bytes = Uint8Array; /** A serializable snapshot of a request and its buffered body. */ export declare class BufferedRequest { readonly url: string; readonly method: string; readonly headers: Record; readonly body: Bytes | null; /** * Creates a buffered request snapshot. * * @param url - Original request URL. * @param method - Original HTTP method. * @param headers - Original headers as string entries. * @param body - Buffered body, or `null` when the request has no body. */ constructor(url: string, method: string, headers: Record, body: Bytes | null); /** * Drains a request into a serializable snapshot. * * @param req - Request to buffer. */ static from(req: Request): Promise; /** Reconstructs a request from this snapshot. */ toRequest(): Request; } /** A serializable snapshot of a response and its buffered body. */ export declare class BufferedResponse { readonly status: number; readonly statusText: string; readonly headers: Record; readonly body: Bytes | null; /** * Creates a buffered response snapshot. * * @param status - Original response status code. * @param statusText - Original response status text. * @param headers - Original headers as string entries. * @param body - Buffered body, or `null` when the response has no body. */ constructor(status: number, statusText: string, headers: Record, body: Bytes | null); /** * Drains a response into a serializable snapshot. * * @param res - Response to buffer. */ static from(res: Response): Promise; /** Reconstructs a response from this snapshot. */ toResponse(): Response; } /** A serializable snapshot of a blob and its buffered bytes. */ export declare class BufferedBlob { readonly type: string; readonly bytes: Bytes; /** * Creates a buffered blob snapshot. * * @param type - Original media type. * @param bytes - Buffered blob contents. */ constructor(type: string, bytes: Bytes); /** * Drains a blob into a serializable snapshot. * * @param blob - Blob to buffer. */ static from(blob: Blob): Promise; /** Reconstructs a blob from this snapshot. */ toBlob(): Blob; } /** A serializable snapshot of a file and its buffered bytes. */ export declare class BufferedFile { readonly name: string; readonly type: string; readonly lastModified: number; readonly bytes: Bytes; /** * Creates a buffered file snapshot. * * @param name - Original file name. * @param type - Original media type. * @param lastModified - Original modification timestamp. * @param bytes - Buffered file contents. */ constructor(name: string, type: string, lastModified: number, bytes: Bytes); /** * Drains a file into a serializable snapshot. * * @param file - File to buffer. */ static from(file: File): Promise; /** Reconstructs a file from this snapshot. */ toFile(): File; } export {};