diff --git a/index.d.ts b/index.d.ts index 650f578e..4e643713 100644 --- a/index.d.ts +++ b/index.d.ts @@ -195,17 +195,18 @@ export interface HttpResponse { /** Resume HTTP request body streaming (unthrottle). */ resume() : void; - /** Accumulates all data chunks and calls handler with the complete body as an ArrayBuffer once all data has arrived. + /** collectBody is a helper function making optimal use of the new onDataV2. + * It allows efficient and easy collection of smallish HTTP request body data into RAM. + * It accumulates all data chunks and calls handler with the complete body as an ArrayBuffer once all data has arrived. * If the total body size exceeds maxSize bytes, handler is called with null instead. */ collectBody(maxSize: number, handler: (fullBody: ArrayBuffer | null) => void) : HttpResponse; /** Handler for reading HTTP request body data. V2. * Must be attached before performing any asynchronous operation, otherwise data may be lost. - * You MUST copy the data of chunk if maxRemainingBodyLength is not 0. We Neuter ArrayBuffers on return, making them zero length. - * + * You MUST copy the data of chunk if maxRemainingBodyLength is not 0n. We Neuter ArrayBuffers on return, making them zero length. * maxRemainingBodyLength is the known maximum of the remaining body length. Can be used to preallocate a receive buffer. */ - onDataV2(handler: (chunk: ArrayBuffer | null, maxRemainingBodyLength: bigint) => void) : HttpResponse; + onDataV2(handler: (chunk: ArrayBuffer, maxRemainingBodyLength: bigint) => void) : HttpResponse; /** Returns the remote IP address in binary format (4 or 16 bytes). */ getRemoteAddress() : ArrayBuffer; diff --git a/source_commit b/source_commit index 8764ee5a..f2f39455 100644 --- a/source_commit +++ b/source_commit @@ -1 +1 @@ -0b0c8f90d3f0b59938c725ca0647458493ee086e +2aff4e4bf4fe6972b0b593de0bf9bc9e2d5e17ba diff --git a/uws_linux_x64_115.node b/uws_linux_x64_115.node index 3e257ebe..c6070585 100644 Binary files a/uws_linux_x64_115.node and b/uws_linux_x64_115.node differ diff --git a/uws_linux_x64_127.node b/uws_linux_x64_127.node index 78cc75a6..541e7c8b 100644 Binary files a/uws_linux_x64_127.node and b/uws_linux_x64_127.node differ diff --git a/uws_linux_x64_137.node b/uws_linux_x64_137.node index 2afbd07a..07a01038 100644 Binary files a/uws_linux_x64_137.node and b/uws_linux_x64_137.node differ diff --git a/uws_linux_x64_141.node b/uws_linux_x64_141.node index 14940efb..35c3ad6e 100644 Binary files a/uws_linux_x64_141.node and b/uws_linux_x64_141.node differ