@versatiles/google-cloud
Version:
A server for VersaTiles in Google Cloud Run
31 lines (30 loc) • 1.42 kB
TypeScript
import type { Responder } from './responder.js';
import { Writable, Readable } from 'stream';
/**
* A writable stream that buffers data up to a maximum size, then switches to stream mode.
* It is used in the recompression process to handle data efficiently.
*/
export declare class BufferStream extends Writable {
#private;
constructor(responder: Responder);
/**
* Handles writing of chunks to the stream.
* @param chunk - The data chunk to write.
* @param encoding - The encoding of the chunk.
* @param callback - Callback to signal completion or error.
*/
_write(chunk: Buffer, encoding: BufferEncoding, callback: (error?: Error | null | undefined) => void): void;
/**
* Finalizes the stream, ensuring all buffered data is written.
* @param callback - Callback to signal completion or error.
*/
_final(callback: (error?: Error | null | undefined) => void): void;
}
/**
* Recompresses a given body (Buffer or Readable stream) using the best available encoding.
* @param responder - The ResponderInterface instance handling the response.
* @param body - The body to recompress, either as a Buffer or a Readable stream.
* @param logPrefix - Optional prefix for logging purposes.
* @returns A promise that resolves when recompression is complete.
*/
export declare function recompress(responder: Responder, body: Buffer | Readable): Promise<void>;