aboutsummaryrefslogtreecommitdiff
path: root/node_modules/into-stream/readme.md
blob: 6c4ed0b6f00e87c0a159eb71270d4d58f7538fc1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# into-stream [![Build Status](https://travis-ci.org/sindresorhus/into-stream.svg?branch=master)](https://travis-ci.org/sindresorhus/into-stream)

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

Correctly chunks up the input and handles backpressure.


## Install

```
$ npm install --save into-stream
```


## Usage

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

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


## API

### intoStream(input)

Type: `Buffer` `string` `Iterable<Buffer|string>` `Promise`<br>
Returns: [Readable stream](https://nodejs.org/api/stream.html#stream_class_stream_readable)

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

### intoStream.obj(input)

Type: `Object`, `Iterable<Object>` `Promise`<br>
Returns: [Readable object stream](https://nodejs.org/api/stream.html#stream_object_mode)


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)