[6a3a178] | 1 | # 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
|
---|
| 13 | npm install --save readable-stream
|
---|
| 14 | ```
|
---|
| 15 |
|
---|
| 16 | This package is a mirror of the streams implementations in Node.js.
|
---|
| 17 |
|
---|
| 18 | Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.19.0/docs/api/stream.html).
|
---|
| 19 |
|
---|
| 20 | If you want to guarantee a stable streams base, regardless of what version of
|
---|
| 21 | Node 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 |
|
---|
| 23 | As of version 2.0.0 **readable-stream** uses semantic versioning.
|
---|
| 24 |
|
---|
| 25 | ## Version 3.x.x
|
---|
| 26 |
|
---|
| 27 | v3.x.x of `readable-stream` is a cut from Node 10. This version supports Node 6, 8, and 10, as well as evergreen browsers, IE 11 and latest Safari. The breaking changes introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/) and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows:
|
---|
| 28 |
|
---|
| 29 | 1. Error codes: https://github.com/nodejs/node/pull/13310,
|
---|
| 30 | https://github.com/nodejs/node/pull/13291,
|
---|
| 31 | https://github.com/nodejs/node/pull/16589,
|
---|
| 32 | https://github.com/nodejs/node/pull/15042,
|
---|
| 33 | https://github.com/nodejs/node/pull/15665,
|
---|
| 34 | https://github.com/nodejs/readable-stream/pull/344
|
---|
| 35 | 2. 'readable' have precedence over flowing
|
---|
| 36 | https://github.com/nodejs/node/pull/18994
|
---|
| 37 | 3. make virtual methods errors consistent
|
---|
| 38 | https://github.com/nodejs/node/pull/18813
|
---|
| 39 | 4. updated streams error handling
|
---|
| 40 | https://github.com/nodejs/node/pull/18438
|
---|
| 41 | 5. writable.end should return this.
|
---|
| 42 | https://github.com/nodejs/node/pull/18780
|
---|
| 43 | 6. readable continues to read when push('')
|
---|
| 44 | https://github.com/nodejs/node/pull/18211
|
---|
| 45 | 7. add custom inspect to BufferList
|
---|
| 46 | https://github.com/nodejs/node/pull/17907
|
---|
| 47 | 8. always defer 'readable' with nextTick
|
---|
| 48 | https://github.com/nodejs/node/pull/17979
|
---|
| 49 |
|
---|
| 50 | ## Version 2.x.x
|
---|
| 51 | v2.x.x of `readable-stream` is a cut of the stream module from Node 8 (there have been no semver-major changes from Node 4 to 8). This version supports all Node.js versions from 0.8, as well as evergreen browsers and IE 10 & 11.
|
---|
| 52 |
|
---|
| 53 | ### Big Thanks
|
---|
| 54 |
|
---|
| 55 | Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce]
|
---|
| 56 |
|
---|
| 57 | # Usage
|
---|
| 58 |
|
---|
| 59 | You can swap your `require('stream')` with `require('readable-stream')`
|
---|
| 60 | without any changes, if you are just using one of the main classes and
|
---|
| 61 | functions.
|
---|
| 62 |
|
---|
| 63 | ```js
|
---|
| 64 | const {
|
---|
| 65 | Readable,
|
---|
| 66 | Writable,
|
---|
| 67 | Transform,
|
---|
| 68 | Duplex,
|
---|
| 69 | pipeline,
|
---|
| 70 | finished
|
---|
| 71 | } = require('readable-stream')
|
---|
| 72 | ````
|
---|
| 73 |
|
---|
| 74 | Note that `require('stream')` will return `Stream`, while
|
---|
| 75 | `require('readable-stream')` will return `Readable`. We discourage using
|
---|
| 76 | whatever is exported directly, but rather use one of the properties as
|
---|
| 77 | shown in the example above.
|
---|
| 78 |
|
---|
| 79 | # Streams Working Group
|
---|
| 80 |
|
---|
| 81 | `readable-stream` is maintained by the Streams Working Group, which
|
---|
| 82 | oversees the development and maintenance of the Streams API within
|
---|
| 83 | Node.js. The responsibilities of the Streams Working Group include:
|
---|
| 84 |
|
---|
| 85 | * Addressing stream issues on the Node.js issue tracker.
|
---|
| 86 | * Authoring and editing stream documentation within the Node.js project.
|
---|
| 87 | * Reviewing changes to stream subclasses within the Node.js project.
|
---|
| 88 | * Redirecting changes to streams from the Node.js project to this
|
---|
| 89 | project.
|
---|
| 90 | * Assisting in the implementation of stream providers within Node.js.
|
---|
| 91 | * Recommending versions of `readable-stream` to be included in Node.js.
|
---|
| 92 | * Messaging about the future of streams to give the community advance
|
---|
| 93 | notice of changes.
|
---|
| 94 |
|
---|
| 95 | <a name="members"></a>
|
---|
| 96 | ## Team Members
|
---|
| 97 |
|
---|
| 98 | * **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com>
|
---|
| 99 | - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
|
---|
| 100 | * **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com>
|
---|
| 101 | * **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com>
|
---|
| 102 | - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
|
---|
| 103 | * **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com>
|
---|
| 104 | * **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) <yoshuawuyts@gmail.com>
|
---|
| 105 |
|
---|
| 106 | [sauce]: https://saucelabs.com
|
---|