XMLHttpRequest for Node.js that emulates the browser XMLHttpRequest object
Overall
score
75%
Implement a small utility that streams a text HTTP response while surfacing incremental progress updates before completion.
onProgress callback for each incoming chunk before the download completes, providing the cumulative bytes received and the latest text fragment. @testonProgress once before completion with the full body length. @testaborted result without emitting any further progress callbacks. @test@generates
/**
* Streams a text response from the given URL and emits progress updates before completion.
*
* @param {object} options
* @param {string} options.url - HTTP or HTTPS endpoint to request.
* @param {(update: { received: number, chunk: string, total?: number }) => void} options.onProgress - called for each chunk before the download finishes.
* @param {AbortSignal} [options.signal] - optional abort signal to halt the request mid-stream.
* @returns {Promise<{ body: string, totalBytes: number, aborted: boolean }>} resolves with the final body and size, or indicates an aborted request.
*/
export function streamTextWithProgress(options);Provides streaming HTTP requests with incremental progress callbacks.
Install with Tessl CLI
npx tessl i tessl/npm-xmlhttprequestdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10