Skip to content

[Node.js] Don't abort the full request for local PDF files smaller than two range requests, and use standard ReadableStreams#20594

Merged
timvandermeij merged 2 commits intomozilla:masterfrom
Snuffleupagus:Node-ReadableStream
Jan 29, 2026
Merged

[Node.js] Don't abort the full request for local PDF files smaller than two range requests, and use standard ReadableStreams#20594
timvandermeij merged 2 commits intomozilla:masterfrom
Snuffleupagus:Node-ReadableStream

Conversation

@Snuffleupagus
Copy link
Collaborator

No description provided.

…than two range requests

This follows the behaviour used with both the Fetch API and `XMLHttpRequest`, compare with the `validateRangeRequestCapabilities` helper function.
Thanks to newer Node.js functionality, see https://nodejs.org/api/stream.html#streamreadabletowebstreamreadable-options, we can use standard `ReadableStream`s which help to significantly shorten and simplify the code.

For older Node.js versions we use the `node-readable-to-web-readable-stream` package, see https://www.npmjs.com/package/node-readable-to-web-readable-stream, to get the same functionality.
@Snuffleupagus
Copy link
Collaborator Author

Snuffleupagus commented Jan 25, 2026

Given that this is Node.js code, it shouldn't be necessary to run any tests besides the CI ones.

@timvandermeij timvandermeij merged commit c0572c1 into mozilla:master Jan 29, 2026
10 checks passed
@timvandermeij
Copy link
Contributor

Thank you for the patch!

@timvandermeij timvandermeij removed the request for review from calixteman January 29, 2026 20:48
@Snuffleupagus Snuffleupagus deleted the Node-ReadableStream branch February 1, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants