Skip to content

Commit 7d83524

Browse files
authored
Update onData() documentation (#1223)
1 parent b0a1028 commit 7d83524

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎docs/index.d.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,6 @@ export interface HttpResponse {
140140
* the user manual under "corking".
141141
*/
142142
writeStatus(status: RecognizedString) : HttpResponse;
143-
144-
/** Pause http body streaming (throttle) */
145-
pause() : void;
146-
147-
/** Resume http body streaming (unthrottle) */
148-
resume() : void;
149-
150143
/** Writes key and value to HTTP response.
151144
* See writeStatus and corking.
152145
*/
@@ -178,8 +171,15 @@ export interface HttpResponse {
178171
* When this event emits, the response has been aborted and may not be used. */
179172
onAborted(handler: () => void) : HttpResponse;
180173

181-
/** Handler for reading data from POST and such requests. You MUST copy the data of chunk if isLast is not true. We Neuter ArrayBuffers on return, making it zero length.*/
174+
/** Handler for reading HTTP request body data.
175+
* Must be attached before performing any asynchronous operation, otherwise data may be lost.
176+
* You MUST copy the data of chunk if isLast is not true. We Neuter ArrayBuffers on return, making them zero length. */
182177
onData(handler: (chunk: ArrayBuffer, isLast: boolean) => void) : HttpResponse;
178+
/** Pause HTTP request body streaming (throttle).
179+
* Some buffered data may still be sent to onData. */
180+
pause() : void;
181+
/** Resume HTTP request body streaming (unthrottle). */
182+
resume() : void;
183183

184184
/** Accumulates all data chunks and calls handler with the complete body as an ArrayBuffer once all data has arrived.
185185
* If the total body size exceeds maxSize bytes, handler is called with null instead. */

0 commit comments

Comments
 (0)