@nestjs/platform-fastify
Version:
Run NestJS on Fastify: the HTTP adapter with Fastify's plugins, JSON schemas and serialization.
25 lines (24 loc) • 975 B
TypeScript
/**
* The chunks of a file, kept until it is buffered. The client decides how a
* request body is cut (down to one byte per chunk with chunked transfer
* encoding), the file stream passes those cuts on, and each chunk is a
* Buffer of its own, which takes a few hundred bytes of memory whatever it
* holds. Every run of `CHUNK_RUN_LENGTH` chunks is therefore merged into one
* Buffer as soon as it is complete, so that a file being uploaded takes
* memory for its size, which `limits.fileSize` bounds, rather than for its
* number of chunks. A run whose chunks average `LARGE_CHUNK_SIZE` bytes or
* more is kept as it is, as merging it would save little.
*
* @internal
*/
export declare class ChunkList {
private readonly chunks;
private size;
private unmerged;
private unmergedSize;
/** The number of Buffers held. */
get count(): number;
push(chunk: Buffer): void;
/** All the chunks, as one Buffer. */
toBuffer(): Buffer;
}