blob: 28ccae161658285d270e66a07362714f268da96b [file] [log] [blame] [view]
Yang Guo4fd355c2019-09-19 08:59:031# readable-stream
2
3***Node.js core streams for userland*** [![Build Status](https://travis-ci.com/nodejs/readable-stream.svg?branch=master)](https://travis-ci.com/nodejs/readable-stream)
4
5
6[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
7[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/)
8
9
10[![Sauce Test Status](https://saucelabs.com/browser-matrix/readabe-stream.svg)](https://saucelabs.com/u/readabe-stream)
11
12```bash
13npm install --save readable-stream
14```
15
16This package is a mirror of the streams implementations in Node.js.
17
18Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.15.3/docs/api/stream.html).
19
20If you want to guarantee a stable streams base, regardless of what version of
21Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
22
23As of version 2.0.0 **readable-stream** uses semantic versioning.
24
25## Version 3.x.x
26
27v3.x.x of `readable-stream` supports Node 6, 8, and 10, as well as
28evergreen browsers, IE 11 and latest Safari. The breaking changes
29introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/)
30and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows:
31
321. Error codes: https://github.com/nodejs/node/pull/13310,
33 https://github.com/nodejs/node/pull/13291,
34 https://github.com/nodejs/node/pull/16589,
35 https://github.com/nodejs/node/pull/15042,
36 https://github.com/nodejs/node/pull/15665,
37 https://github.com/nodejs/readable-stream/pull/344
382. 'readable' have precedence over flowing
39 https://github.com/nodejs/node/pull/18994
403. make virtual methods errors consistent
41 https://github.com/nodejs/node/pull/18813
424. updated streams error handling
43 https://github.com/nodejs/node/pull/18438
445. writable.end should return this.
45 https://github.com/nodejs/node/pull/18780
466. readable continues to read when push('')
47 https://github.com/nodejs/node/pull/18211
487. add custom inspect to BufferList
49 https://github.com/nodejs/node/pull/17907
508. always defer 'readable' with nextTick
51 https://github.com/nodejs/node/pull/17979
52
53## Version 2.x.x
54
55v2.x.x of `readable-stream` supports all Node.js version from 0.8, as well as
56evergreen browsers and IE 10 & 11.
57
58### Big Thanks
59
60Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce]
61
62# Usage
63
64You can swap your `require('stream')` with `require('readable-stream')`
65without any changes, if you are just using one of the main classes and
66functions.
67
68```js
69const {
70 Readable,
71 Writable,
72 Transform,
73 Duplex,
74 pipeline,
75 finished
76} = require('readable-stream')
77````
78
79Note that `require('stream')` will return `Stream`, while
80`require('readable-stream')` will return `Readable`. We discourage using
81whatever is exported directly, but rather use one of the properties as
82shown in the example above.
83
84# Streams Working Group
85
86`readable-stream` is maintained by the Streams Working Group, which
87oversees the development and maintenance of the Streams API within
88Node.js. The responsibilities of the Streams Working Group include:
89
90* Addressing stream issues on the Node.js issue tracker.
91* Authoring and editing stream documentation within the Node.js project.
92* Reviewing changes to stream subclasses within the Node.js project.
93* Redirecting changes to streams from the Node.js project to this
94 project.
95* Assisting in the implementation of stream providers within Node.js.
96* Recommending versions of `readable-stream` to be included in Node.js.
97* Messaging about the future of streams to give the community advance
98 notice of changes.
99
100<a name="members"></a>
101## Team Members
102
103* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) &lt;[email protected]&gt;
104 - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
105* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;[email protected]&gt;
106* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) &lt;[email protected]&gt;
107 - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
108* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) &lt;[email protected]&gt;
109* **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) &lt;[email protected]&gt;
110
111[sauce]: https://saucelabs.com