You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 4.6KB

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