Builds regenerative, resumable Node.js readable streams that automatically retry on failure. Version 0.8.2 – stable, with TypeScript definitions included. Unlike manual retry logic or generic stream wrappers, xresilient tracks bytes read and supports range headers for resumable HTTP downloads. The stream can retry a user-supplied generator function a configurable number of times (default 5), emitting 'retry' and 'error' events. It extends stream.ReadableOptions, allowing custom destroyer functions and seamless integration with Node's stream pipeline. Suitable for fetching large files over unreliable networks.
npm install xresilientVerified import paths — ran on the pinned version, not inferred.
Creates a resumable stream that re-fetches a file with Range header on error, piping to disk.
Ensure fn always returns a valid, non-ended Readable stream unless you intend to end the resilient stream.
Listen to the 'retry' event to be notified of errors during retries, or check retryCount in the generator.
Wrap the stream to convert 'close' into 'error' if needed, or rely only on 'error' events.
Use const xresilient = require('xresilient').default instead of require('xresilient').Ensure the generator creates a new stream each invocation, and avoid reusing destroyed streams.
Add `retriableStream.on('error', ...)` to handle final errors.No dependency data recorded yet.