CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-xmlhttprequest

tessl install tessl/npm-xmlhttprequest@1.8.0

XMLHttpRequest for Node.js that emulates the browser XMLHttpRequest object

Agent Success

Agent success rate when using this tile

75%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.15x

Baseline

Agent success rate without this tile

65%

task.mdevals/scenario-7/

Streaming Text Progress

Implement a small utility that streams a text HTTP response while surfacing incremental progress updates before completion.

Capabilities

Emits progress events while streaming

  • When the response arrives in multiple chunks, invoke the supplied onProgress callback for each incoming chunk before the download completes, providing the cumulative bytes received and the latest text fragment. @test
  • For a short response that arrives in a single chunk, still call onProgress once before completion with the full body length. @test

Returns final result

  • Resolve with the concatenated response body and total byte count after the stream finishes, regardless of how many progress updates were emitted. @test

Supports caller-driven cancellation

  • If the caller aborts while streaming, stop the request immediately and surface an aborted result without emitting any further progress callbacks. @test

Implementation

@generates

API

/**
 * 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);

Dependencies { .dependencies }

xmlhttprequest { .dependency }

Provides streaming HTTP requests with incremental progress callbacks.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/xmlhttprequest@1.8.x
tile.json