Convert a buffer/string/array/object/iterable/promise into a stream
JavaScript
Switch branches/tags
Clone or download
Latest commit 05b9ac0 Aug 3, 2018
Permalink
Failed to load latest commit information.
.editorconfig Require Node.js 6 Aug 3, 2018
.gitattributes Require Node.js 6 Aug 3, 2018
.gitignore Require Node.js 6 Aug 3, 2018
.npmrc Require Node.js 6 Aug 3, 2018
.travis.yml Require Node.js 6 Aug 3, 2018
index.js Require Node.js 6 Aug 3, 2018
license Require Node.js 6 Aug 3, 2018
package.json Require Node.js 6 Aug 3, 2018
readme.md Require Node.js 6 Aug 3, 2018
test.js Require Node.js 6 Aug 3, 2018

readme.md

into-stream Build Status

Convert a buffer/string/array/object/iterable/promise into a stream

Correctly chunks up the input and handles backpressure.

Install

$ npm install into-stream

Usage

const intoStream = require('into-stream');

intoStream('unicorn').pipe(process.stdout);
//=> 'unicorn'

API

intoStream(input)

Type: Buffer string Iterable<Buffer|string> Promise
Returns: Readable stream

Adheres to the requested chunk size, except for array where each element will be a chunk.

intoStream.obj(input)

Type: Object, Iterable<Object> Promise
Returns: Readable object stream

Related

License

MIT © Sindre Sorhus