Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nodejs/readable-stream
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 758c8b3845af855fde736b6a7f58a15fba00d1e7
Choose a base ref
...
head repository: nodejs/readable-stream
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2eb8861e029107b7e079e22c826835cad6ae7854
Choose a head ref
Loading
Showing with 9,579 additions and 4,685 deletions.
  1. +2 −0 .gitignore
  2. +1 −0 .npmignore
  3. +12 −27 .travis.yml
  4. +38 −0 CONTRIBUTING.md
  5. +136 −0 GOVERNANCE.md
  6. +29 −0 LICENSE
  7. +26 −4 README.md
  8. +123 −52 build/build.js
  9. +7 −2 build/common-replacements.js
  10. +0 −6 build/doc-replacements.js
  11. +126 −56 build/files.js
  12. +15 −7 build/package.json
  13. +65 −2 build/test-replacements.js
  14. +0 −2,015 doc/stream.md
  15. +1 −0 duplex-browser.js
  16. +1 −1 duplex.js
  17. +70 −14 lib/_stream_duplex.js
  18. +22 −1 lib/_stream_passthrough.js
  19. +210 −128 lib/_stream_readable.js
  20. +69 −35 lib/_stream_transform.js
  21. +246 −85 lib/_stream_writable.js
  22. +68 −53 lib/internal/streams/BufferList.js
  23. +74 −0 lib/internal/streams/destroy.js
  24. +1 −0 lib/internal/streams/stream-browser.js
  25. +1 −0 lib/internal/streams/stream.js
  26. +17 −14 package.json
  27. +1 −1 passthrough.js
  28. +7 −0 readable-browser.js
  29. +17 −14 readable.js
  30. +1 −1 test/browser/test-stream2-readable-from-list.js
  31. +0 −523 test/common.js
  32. +537 −0 test/common/README.md
  33. +62 −0 test/common/benchmark.js
  34. +70 −0 test/common/countdown.js
  35. +418 −0 test/common/dns.js
  36. +94 −0 test/common/duplexpair.js
  37. +65 −0 test/common/fixtures.js
  38. +955 −0 test/common/index.js
  39. +131 −0 test/common/index.mjs
  40. +560 −0 test/common/inspector-helper.js
  41. +64 −0 test/common/wpt.js
  42. +39 −0 test/ours/lolex-fake-timers.js
  43. +49 −24 test/parallel/test-stream-big-packet.js
  44. +35 −25 test/parallel/test-stream-big-push.js
  45. +29 −0 test/parallel/test-stream-buffer-list.js
  46. +2 −1 test/parallel/test-stream-decoder-objectmode.js
  47. +223 −0 test/parallel/test-stream-duplex-destroy.js
  48. +28 −7 test/parallel/test-stream-duplex.js
  49. +24 −3 test/parallel/test-stream-end-paused.js
  50. +52 −0 test/parallel/test-stream-events-prepend.js
  51. +22 −2 test/parallel/test-stream-ispaused.js
  52. +50 −0 test/parallel/test-stream-objectmode-undefined.js
  53. +77 −47 test/parallel/test-stream-pipe-after-end.js
  54. +6 −1 test/parallel/test-stream-pipe-await-drain-manual-resume.js
  55. +15 −3 test/parallel/test-stream-pipe-await-drain-push-while-write.js
  56. +14 −2 test/parallel/test-stream-pipe-await-drain.js
  57. +2 −2 test/parallel/test-stream-pipe-cleanup-pause.js
  58. +51 −30 test/parallel/test-stream-pipe-cleanup.js
  59. +65 −48 test/parallel/test-stream-pipe-error-handling.js
  60. +22 −1 test/parallel/test-stream-pipe-event.js
  61. +3 −3 test/parallel/test-stream-pipe-multiple-pipes.js
  62. +83 −0 test/parallel/test-stream-pipe-same-destination-twice.js
  63. +37 −0 test/parallel/test-stream-pipe-unpipe-streams.js
  64. +4 −6 test/parallel/test-stream-pipe-without-listenerCount.js
  65. +23 −2 test/parallel/test-stream-push-order.js
  66. +66 −29 test/parallel/test-stream-push-strings.js
  67. +5 −13 test/parallel/test-stream-readable-constructor-set-methods.js
  68. +186 −0 test/parallel/test-stream-readable-destroy.js
  69. +72 −0 test/parallel/test-stream-readable-emittedReadable.js
  70. +62 −47 test/parallel/test-stream-readable-event.js
  71. +26 −5 test/parallel/test-stream-readable-flow-recursion.js
  72. +6 −4 test/parallel/test-stream-readable-invalid-chunk.js
  73. +98 −0 test/parallel/test-stream-readable-needReadable.js
  74. +66 −0 test/parallel/test-stream-readable-reading-readingMore.js
  75. +76 −0 test/parallel/test-stream-readable-resumeScheduled.js
  76. +1 −1 test/parallel/test-stream-readable-with-unimplemented-_read.js
  77. +36 −0 test/parallel/test-stream-readableListening-state.js
  78. +20 −0 test/parallel/test-stream-transform-callback-twice.js
  79. +21 −15 test/parallel/test-stream-transform-constructor-set-methods.js
  80. +151 −0 test/parallel/test-stream-transform-destroy.js
  81. +102 −0 test/parallel/test-stream-transform-final-sync.js
  82. +104 −0 test/parallel/test-stream-transform-final.js
  83. +27 −0 test/parallel/test-stream-transform-flush-data.js
  84. +29 −11 test/parallel/test-stream-transform-objectmode-falsey-value.js
  85. +76 −0 test/parallel/test-stream-transform-split-highwatermark.js
  86. +34 −9 test/parallel/test-stream-transform-split-objectmode.js
  87. +107 −0 test/parallel/test-stream-uint8array.js
  88. +132 −0 test/parallel/test-stream-unpipe-event.js
  89. +24 −3 test/parallel/test-stream-unshift-empty-chunk.js
  90. +40 −26 test/parallel/test-stream-unshift-read-race.js
  91. +49 −15 test/parallel/test-stream-writable-change-default-encoding.js
  92. +4 −4 test/parallel/test-stream-writable-constructor-set-methods.js
  93. +45 −11 test/parallel/test-stream-writable-decoded-encoding.js
  94. +217 −0 test/parallel/test-stream-writable-destroy.js
  95. +23 −0 test/parallel/test-stream-writable-ended-state.js
  96. +24 −0 test/parallel/test-stream-writable-finished-state.js
  97. +25 −0 test/parallel/test-stream-writable-needdrain-state.js
  98. +23 −12 test/parallel/test-stream-writable-null.js
  99. +158 −0 test/parallel/test-stream-writable-write-writev-finish.js
  100. +36 −0 test/parallel/test-stream-writableState-ending.js
  101. +59 −0 test/parallel/test-stream-writableState-uncorked-bufferedRequestCount.js
  102. +26 −0 test/parallel/test-stream-write-final.js
  103. +28 −9 test/parallel/test-stream-writev.js
  104. +26 −6 test/parallel/test-stream2-base64-single-char-read-end.js
  105. +398 −0 test/parallel/test-stream2-basic.js
  106. +66 −25 test/parallel/test-stream2-compatibility.js
  107. +3 −3 test/parallel/test-stream2-decode-partial.js
  108. +22 −2 test/parallel/test-stream2-finish-pipe.js
  109. +32 −12 test/parallel/test-stream2-large-read-stall.js
  110. +161 −190 test/parallel/test-stream2-objects.js
  111. +97 −80 test/parallel/test-stream2-pipe-error-handling.js
  112. +60 −20 test/parallel/test-stream2-pipe-error-once-listener.js
  113. +29 −7 test/parallel/test-stream2-push.js
  114. +23 −2 test/parallel/test-stream2-read-sync-stack.js
  115. +44 −24 test/parallel/test-stream2-readable-empty-buffer-no-eof.js
  116. +44 −58 test/parallel/test-stream2-readable-from-list.js
  117. +24 −3 test/parallel/test-stream2-readable-legacy-drain.js
  118. +28 −7 test/parallel/test-stream2-readable-non-empty-end.js
  119. +23 −2 test/parallel/test-stream2-readable-wrap-empty.js
  120. +168 −173 test/parallel/test-stream2-set-encoding.js
  121. +285 −308 test/parallel/test-stream2-transform.js
  122. +63 −27 test/parallel/test-stream2-unpipe-drain.js
  123. +66 −24 test/parallel/test-stream2-unpipe-leak.js
  124. +252 −228 test/parallel/test-stream2-writable.js
  125. +7 −7 test/parallel/test-stream3-cork-end.js
  126. +7 −7 test/parallel/test-stream3-cork-uncork.js
  127. +27 −6 test/parallel/test-stream3-pause-then-read.js
  128. +20 −0 test/parallel/test-streams-highwatermark.js
  129. +13 −0 test/verify-dependencies.js
  130. +1 −1 transform.js
  131. +1 −0 writable-browser.js
  132. +8 −1 writable.js
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -2,3 +2,5 @@ node_modules/
.zuul.yml
.nyc_output
coverage
package-lock.json
*.tap
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -6,3 +6,4 @@ zlib.js
.zuul.yml
.nyc_output
coverage
docs/
39 changes: 12 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,33 @@
sudo: false
language: node_js
before_install:
- npm install -g npm@2
- npm install -g npm
- (test $NPM_LEGACY && npm install -g npm@2 && npm install -g npm@3) || true
notifications:
email: false
matrix:
fast_finish: true
include:
- node_js: '0.8'
env: TASK=test
env: NPM_LEGACY=true
- node_js: '0.10'
env: TASK=test
env: NPM_LEGACY=true
- node_js: '0.11'
env: TASK=test
env: NPM_LEGACY=true
- node_js: '0.12'
env: TASK=test
env: NPM_LEGACY=true
- node_js: 1
env: TASK=test
env: NPM_LEGACY=true
- node_js: 2
env: TASK=test
env: NPM_LEGACY=true
- node_js: 3
env: TASK=test
env: NPM_LEGACY=true
- node_js: 4
env: TASK=test
- node_js: 5
env: TASK=test
- node_js: 6
env: TASK=test
- node_js: 5
env: TASK=browser BROWSER_NAME=android BROWSER_VERSION="4.0..latest"
- node_js: 5
env: TASK=browser BROWSER_NAME=ie BROWSER_VERSION="9..latest"
- node_js: 5
env: TASK=browser BROWSER_NAME=opera BROWSER_VERSION="11..latest"
- node_js: 5
env: TASK=browser BROWSER_NAME=chrome BROWSER_VERSION="-3..latest"
- node_js: 5
env: TASK=browser BROWSER_NAME=firefox BROWSER_VERSION="-3..latest"
- node_js: 5
env: TASK=browser BROWSER_NAME=safari BROWSER_VERSION="5..latest"
- node_js: 5
env: TASK=browser BROWSER_NAME=microsoftedge BROWSER_VERSION=latest
script: "npm run $TASK"
- node_js: 7
- node_js: 8
- node_js: 9
script: "npm run test"
env:
global:
- secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc=
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

* (a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

* (b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

* (c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

* (d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

## Moderation Policy

The [Node.js Moderation Policy] applies to this WG.

## Code of Conduct

The [Node.js Code of Conduct][] applies to this WG.

[Node.js Code of Conduct]:
https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md
[Node.js Moderation Policy]:
https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md
136 changes: 136 additions & 0 deletions GOVERNANCE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
### Streams Working Group

The Node.js Streams is jointly governed by a Working Group
(WG)
that is responsible for high-level guidance of the project.

The WG has final authority over this project including:

* Technical direction
* Project governance and process (including this policy)
* Contribution policy
* GitHub repository hosting
* Conduct guidelines
* Maintaining the list of additional Collaborators

For the current list of WG members, see the project
[README.md](./README.md#current-project-team-members).

### Collaborators

The readable-stream GitHub repository is
maintained by the WG and additional Collaborators who are added by the
WG on an ongoing basis.

Individuals making significant and valuable contributions are made
Collaborators and given commit-access to the project. These
individuals are identified by the WG and their addition as
Collaborators is discussed during the WG meeting.

_Note:_ If you make a significant contribution and are not considered
for commit-access log an issue or contact a WG member directly and it
will be brought up in the next WG meeting.

Modifications of the contents of the readable-stream repository are
made on
a collaborative basis. Anybody with a GitHub account may propose a
modification via pull request and it will be considered by the project
Collaborators. All pull requests must be reviewed and accepted by a
Collaborator with sufficient expertise who is able to take full
responsibility for the change. In the case of pull requests proposed
by an existing Collaborator, an additional Collaborator is required
for sign-off. Consensus should be sought if additional Collaborators
participate and there is disagreement around a particular
modification. See _Consensus Seeking Process_ below for further detail
on the consensus model used for governance.

Collaborators may opt to elevate significant or controversial
modifications, or modifications that have not found consensus to the
WG for discussion by assigning the ***WG-agenda*** tag to a pull
request or issue. The WG should serve as the final arbiter where
required.

For the current list of Collaborators, see the project
[README.md](./README.md#members).

### WG Membership

WG seats are not time-limited. There is no fixed size of the WG.
However, the expected target is between 6 and 12, to ensure adequate
coverage of important areas of expertise, balanced with the ability to
make decisions efficiently.

There is no specific set of requirements or qualifications for WG
membership beyond these rules.

The WG may add additional members to the WG by unanimous consensus.

A WG member may be removed from the WG by voluntary resignation, or by
unanimous consensus of all other WG members.

Changes to WG membership should be posted in the agenda, and may be
suggested as any other agenda item (see "WG Meetings" below).

If an addition or removal is proposed during a meeting, and the full
WG is not in attendance to participate, then the addition or removal
is added to the agenda for the subsequent meeting. This is to ensure
that all members are given the opportunity to participate in all
membership decisions. If a WG member is unable to attend a meeting
where a planned membership decision is being made, then their consent
is assumed.

No more than 1/3 of the WG members may be affiliated with the same
employer. If removal or resignation of a WG member, or a change of
employment by a WG member, creates a situation where more than 1/3 of
the WG membership shares an employer, then the situation must be
immediately remedied by the resignation or removal of one or more WG
members affiliated with the over-represented employer(s).

### WG Meetings

The WG meets occasionally on a Google Hangout On Air. A designated moderator
approved by the WG runs the meeting. Each meeting should be
published to YouTube.

Items are added to the WG agenda that are considered contentious or
are modifications of governance, contribution policy, WG membership,
or release process.

The intention of the agenda is not to approve or review all patches;
that should happen continuously on GitHub and be handled by the larger
group of Collaborators.

Any community member or contributor can ask that something be added to
the next meeting's agenda by logging a GitHub Issue. Any Collaborator,
WG member or the moderator can add the item to the agenda by adding
the ***WG-agenda*** tag to the issue.

Prior to each WG meeting the moderator will share the Agenda with
members of the WG. WG members can add any items they like to the
agenda at the beginning of each meeting. The moderator and the WG
cannot veto or remove items.

The WG may invite persons or representatives from certain projects to
participate in a non-voting capacity.

The moderator is responsible for summarizing the discussion of each
agenda item and sends it as a pull request after the meeting.

### Consensus Seeking Process

The WG follows a
[Consensus
Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making)
decision-making model.

When an agenda item has appeared to reach a consensus the moderator
will ask "Does anyone object?" as a final call for dissent from the
consensus.

If an agenda item cannot reach a consensus a WG member can call for
either a closing vote or a vote to table the issue to the next
meeting. The call for a vote must be seconded by a majority of the WG
or else the discussion will continue. Simple majority wins.

Note that changes to WG membership require a majority consensus. See
"WG Membership" above.
29 changes: 29 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
Node.js is licensed for use as follows:

"""
Copyright Node.js contributors. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
"""

This license applies to parts of Node.js originating from the
https://github.com/joyent/node repository:

"""
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -16,3 +44,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
"""
30 changes: 26 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# readable-stream

***Node-core v6.3.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)
***Node-core v8.11.1 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream)


[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/)
@@ -16,14 +16,33 @@ npm install --save readable-stream
***Node-core streams for userland***

This package is a mirror of the Streams2 and Streams3 implementations in
Node-core, including [documentation](doc/stream.md).
Node-core.

Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/docs/api/stream.html).

If you want to guarantee a stable streams base, regardless of what version of
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).

As of version 2.0.0 **readable-stream** uses semantic versioning.
As of version 2.0.0 **readable-stream** uses semantic versioning.

# Streams Working Group

`readable-stream` is maintained by the Streams Working Group, which
oversees the development and maintenance of the Streams API within
Node.js. The responsibilities of the Streams Working Group include:

* Addressing stream issues on the Node.js issue tracker.
* Authoring and editing stream documentation within the Node.js project.
* Reviewing changes to stream subclasses within the Node.js project.
* Redirecting changes to streams from the Node.js project to this
project.
* Assisting in the implementation of stream providers within Node.js.
* Recommending versions of `readable-stream` to be included in Node.js.
* Messaging about the future of streams to give the community advance
notice of changes.

# Streams WG Team Members
<a name="members"></a>
## Team Members

* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) &lt;christopher.s.dickinson@gmail.com&gt;
- Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
@@ -34,3 +53,6 @@ As of version 2.0.0 **readable-stream** uses semantic versioning.
* **Sam Newman** ([@sonewman](https://github.com/sonewman)) &lt;newmansam@outlook.com&gt;
* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) &lt;mathiasbuus@gmail.com&gt;
* **Domenic Denicola** ([@domenic](https://github.com/domenic)) &lt;d@domenic.me&gt;
* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) &lt;matteo.collina@gmail.com&gt;
- Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) &lt;shestak.irina@gmail.com&gt;
Loading