The `readable-stream-node-to-web` package offers a utility to convert a Node.js `Readable` stream into a WHATWG `ReadableStream`, commonly known as a web stream. This bridge allows developers to use Node.js stream-producing modules within web-native contexts such as Service Workers or modern browser environments, where web streams are the standard. The current and last published stable version is 1.0.1, released approximately nine years ago. Due to its age and the subsequent introduction of native stream conversion utilities directly within Node.js (e.g., `stream.Readable.toWeb()` since Node.js v17), this package is largely superseded. Its development is effectively halted, and users are encouraged to explore native Node.js APIs or more actively maintained alternatives for stream interoperability. The module was written in ES5 and was compatible with bundlers like Browserify and Webpack without needing transpilation.
npm install readable-stream-node-to-webVerified import paths — ran on the pinned version, not inferred.
Demonstrates converting a mock Node.js Readable stream to a WHATWG ReadableStream and then consuming its data using a web stream reader.
Consider using native Node.js stream conversion utilities like `stream.Readable.toWeb()` (available since Node.js v17) or `stream.Readable.fromWeb()`. Alternatively, explore more actively maintained libraries such as `node-readable-to-web-readable-stream` for robust stream interoperability.
For native ESM environments, explicitly use dynamic `import()` or switch to a native ESM-first library that provides this functionality. If bundling, ensure your bundler is configured for CJS interop.
Upgrade to Node.js v17+ and use `import { Readable } from 'node:stream'; const webStream = nodeStream.toWeb();`. This leverages core Node.js functionality without external dependencies.Ensure you are using `const nodeToWebStream = require('readable-stream-node-to-web');` for CommonJS. If in an ESM file, bundlers might support `import nodeToWebStream from 'readable-stream-node-to-web';` but direct Node.js ESM might need careful handling or a switch to native APIs.Ensure Node.js is v17 or newer for native `.toWeb()` support. If using an older Node.js, you must use this `readable-stream-node-to-web` package (or a similar alternative) for conversion. For TypeScript, ensure your `tsconfig.json` targets a Node.js version that includes these types or add a custom declaration file.
No dependency data recorded yet.