https://github.com/xuset/readable-stream-node-to-web
Convert a nodejs Readable stream to a web ReadableStream
https://github.com/xuset/readable-stream-node-to-web
Last synced: 5 months ago
JSON representation
Convert a nodejs Readable stream to a web ReadableStream
- Host: GitHub
- URL: https://github.com/xuset/readable-stream-node-to-web
- Owner: xuset
- License: mit
- Created: 2017-08-02T03:47:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-18T19:50:47.000Z (over 2 years ago)
- Last Synced: 2025-05-27T04:16:42.508Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 5.86 KB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# readable-stream-node-to-web [](https://travis-ci.org/xuset/readable-stream-node-to-web) [](https://npmjs.org/package/readable-stream-node-to-web)
#### Convert a nodejs Readable stream to a web ReadableStream
[](https://saucelabs.com/u/xuset-readable-stream-node-to-web)
```js
var nodeToWebStream = require('readable-stream-node-to-web');
var nodeStream = // Obtain a nodejs Readable stream
var webStream = nodeToWebStream(nodeStream);
```
`nodeStream` is a [NodeJS Readable stream](https://nodejs.org/api/stream.html#stream_readable_streams)
`webStream` is a [WhatWG web ReadableStream](https://streams.spec.whatwg.org/#rs-class)
This method takes a readable node stream and returns a web stream to reads from given the node stream. This allows the plethora of nodejs modules involving Readable streams to be used in a web context like using a node stream with [FetchEvent.respondWith()](https://developer.mozilla.org/en-US/docs/Web/API/FetchEvent/respondWith)
This module can be used with bundlers like browserify or webpack. This module is also written in es5 so there is no need for transpilation.
## License
MIT. Copyright (c) Austin Middleton.