diff --git a/index.d.ts b/index.d.ts index 4e643713..4b8cd172 100644 --- a/index.d.ts +++ b/index.d.ts @@ -47,11 +47,10 @@ export interface AppDescriptor { * This because we expect UTF-8, which is packed in 8-byte chars. JavaScript strings are UTF-16 internally meaning extra copies and reinterpretation are required. * * That's why all events pass data by ArrayBuffer and not JavaScript strings, as they allow zero-copy data passing. + * * You can always do Buffer.from(arrayBuffer).toString(), but keeping things binary and as ArrayBuffer is preferred. - * - * The ArrayBufferView type includes Node.js Buffer, DataView, and TypedArray (Uint8Array, Uint16Array, ...). */ -export type RecognizedString = string | ArrayBuffer | SharedArrayBuffer | ArrayBufferView; +export type RecognizedString = string | ArrayBuffer | Uint8Array | Int8Array | Uint16Array | Int16Array | Uint32Array | Int32Array | Float32Array | Float64Array; /** A WebSocket connection that is valid from open to close event. * Read more about this in the user manual. @@ -195,18 +194,17 @@ export interface HttpResponse { /** Resume HTTP request body streaming (unthrottle). */ resume() : void; - /** 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. + /** 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 0n. We Neuter ArrayBuffers on return, making them zero length. + * You MUST copy the data of chunk if maxRemainingBodyLength is not 0. 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, maxRemainingBodyLength: bigint) => void) : HttpResponse; + onDataV2(handler: (chunk: ArrayBuffer | null, 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 f2f39455..5888dff9 100644 --- a/source_commit +++ b/source_commit @@ -1 +1 @@ -2aff4e4bf4fe6972b0b593de0bf9bc9e2d5e17ba +1c03fa0b7911bcf1aedeef92df9a5e1e17d30089 diff --git a/uws_darwin_arm64_115.node b/uws_darwin_arm64_115.node index 7845529e..17f4b3b9 100644 Binary files a/uws_darwin_arm64_115.node and b/uws_darwin_arm64_115.node differ diff --git a/uws_darwin_arm64_127.node b/uws_darwin_arm64_127.node index f71f0326..c6d80657 100644 Binary files a/uws_darwin_arm64_127.node and b/uws_darwin_arm64_127.node differ diff --git a/uws_darwin_arm64_137.node b/uws_darwin_arm64_137.node index 2a2d6acc..e49a710b 100644 Binary files a/uws_darwin_arm64_137.node and b/uws_darwin_arm64_137.node differ diff --git a/uws_darwin_arm64_141.node b/uws_darwin_arm64_141.node index 4d517ec7..3203d13d 100644 Binary files a/uws_darwin_arm64_141.node and b/uws_darwin_arm64_141.node differ diff --git a/uws_darwin_x64_115.node b/uws_darwin_x64_115.node index 0cf24098..609e56ad 100644 Binary files a/uws_darwin_x64_115.node and b/uws_darwin_x64_115.node differ diff --git a/uws_darwin_x64_127.node b/uws_darwin_x64_127.node index e356dfea..f794f392 100644 Binary files a/uws_darwin_x64_127.node and b/uws_darwin_x64_127.node differ diff --git a/uws_darwin_x64_137.node b/uws_darwin_x64_137.node index aa6591c7..fb687540 100644 Binary files a/uws_darwin_x64_137.node and b/uws_darwin_x64_137.node differ diff --git a/uws_darwin_x64_141.node b/uws_darwin_x64_141.node index 2c7eeb67..37590876 100644 Binary files a/uws_darwin_x64_141.node and b/uws_darwin_x64_141.node differ