https://github.com/sindresorhus/to-readable-stream
Convert a string/Buffer/Uint8Array to a readable stream
https://github.com/sindresorhus/to-readable-stream
nodejs npm-package readable-stream stream
Last synced: about 2 months ago
JSON representation
Convert a string/Buffer/Uint8Array to a readable stream
- Host: GitHub
- URL: https://github.com/sindresorhus/to-readable-stream
- Owner: sindresorhus
- License: mit
- Created: 2018-05-01T10:09:15.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2022-10-26T14:38:58.000Z (over 2 years ago)
- Last Synced: 2025-03-27T02:46:11.720Z (about 2 months ago)
- Topics: nodejs, npm-package, readable-stream, stream
- Language: JavaScript
- Size: 19.5 KB
- Stars: 90
- Watchers: 3
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/funding.yml
- License: license
- Security: .github/security.md
Awesome Lists containing this project
README
# to-readable-stream
> Convert a value to a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)
Not to be confused with [Node.js `stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable), in which case, [`stream.Readable#from()`](https://nodejs.org/api/stream.html#stream_stream_readable_from_iterable_options) should be used instead.
## Install
```sh
npm install to-readable-stream
```## Usage
```js
import toReadableStream from 'to-readable-stream';toReadableStream('🦄🌈');
//=> ReadableStream<'🦄🌈'>
```## API
### toReadableStream(value)
Returns a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream).
#### value
The value to convert to a stream.
## Related
- [into-stream](https://github.com/sindresorhus/into-stream) - More advanced version of this package
- [get-stream](https://github.com/sindresorhus/get-stream) - The opposite of this package