summaryrefslogtreecommitdiff
path: root/lib/_stream_duplex.js
AgeCommit message (Collapse)Author
2019-11-25lib: flatten access to primordialsMichaël Zasso
Store all primordials as properties of the primordials object. Static functions are prefixed by the constructor's name and prototype methods are prefixed by the constructor's name followed by "Prototype". For example: primordials.Object.keys becomes primordials.ObjectKeys. PR-URL: https://github.com/nodejs/node/pull/30610 Refs: https://github.com/nodejs/node/issues/29766 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2019-11-13stream: add writableCorked to DuplexAnna Henningsen
PR-URL: https://github.com/nodejs/node/pull/29053 Reviewed-By: Anna Henningsen <anna@addaleax.net>
2019-11-09lib: change var to let in lib/_stream_duplex.jsIlia Safronov
PR-URL: https://github.com/nodejs/node/pull/30297 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
2019-08-17http,stream: add writableEndedRobert Nagy
This is work towards resolving the response.finished confusion and future deprecation. Note that implementation-wise, streams have both an ending and ended state. However, in this case (in order to avoid confusion in user space) writableEnded is equal to writable.ending. The ending vs ended situation is internal state required for internal stream logic. PR-URL: https://github.com/nodejs/node/pull/28934 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-06-25stream: add writableFinishedzero1five
add a new getter to duplex stream to replace the property `this .writableState.finished` of the object that inherited duplex. Refs: https://github.com/nodejs/node/issues/445 PR-URL: https://github.com/nodejs/node/pull/28007 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-04-12lib: enforce the use of Object from primordialsMichaël Zasso
PR-URL: https://github.com/nodejs/node/pull/27146 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
2019-03-27benchmark,doc,lib: capitalize more commentsRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/26849 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2019-03-10benchmark,doc,lib,test: capitalize commentsRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/26483 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
2019-02-28benchmark,doc,lib,test: capitalize commentsRuben Bridgewater
This updates a lot of comments. PR-URL: https://github.com/nodejs/node/pull/26223 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
2018-12-17doc,lib,test: capitalize comment sentencesRuben Bridgewater
This activates the eslint capitalize comment rule for comments above 50 characters. PR-URL: https://github.com/nodejs/node/pull/24996 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-12-05lib: use ES6 class inheritance styleRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/24755 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-12-05lib: remove `inherits()` usageRuben Bridgewater
This switches all `util.inherits()` calls to use `Object.setPrototypeOf()` instead. In fact, `util.inherits()` is mainly a small wrapper around exactly this function while adding the `_super` property on the object as well. Refs: #24395 PR-URL: https://github.com/nodejs/node/pull/24755 Refs: https://github.com/nodejs/node/issues/24395 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2018-04-28stream: only check options once in Duplex ctorDaniel Bevenius
This commit updates the Duplex constructor adding an if statement checking if options is undefined, and removes the check from the following three if statements. PR-URL: https://github.com/nodejs/node/pull/20353 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2018-04-06net,stream: remove DuplexBaseLuigi Pinca
`DuplexBase` was added to prevent the "no-half-open enforcer" from being inherited by `net.Socket`. The main reason to use it instead of `Duplex` was that it allowed to not copy the options object but since commit 5e3f516 the options object is copyed anyway so it is no longer useful. PR-URL: https://github.com/nodejs/node/pull/19779 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2018-03-07stream: make Duplex inherits from DuplexBaseLuigi Pinca
Add ability to subclass `stream.Duplex` without inheriting the "no-half-open enforcer" regardless of the value of the `allowHalfOpen` option. PR-URL: https://github.com/nodejs/node/pull/18974 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chen Gang <gangc.cxy@foxmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-03-06stream: updated streams error handlingMathias Buus
This improves error handling for streams in a few ways. 1. It ensures that no user defined methods (_read, _write, ...) are run after .destroy has been called. 2. It introduces an explicit error to tell the user if they are write to write, etc to the stream after it has been destroyed. 3. It makes streams always emit close as the last thing after they have been destroyed 4. Changes the default _destroy to not gracefully end streams. It also updates net, http2, zlib and fs to the new error handling. PR-URL: https://github.com/nodejs/node/pull/18438 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
2018-03-04stream: add no-half-open enforcer only if neededLuigi Pinca
The listener does not do anything if `allowHalfOpen` is enabled. Add it only when `allowHalfOpen` is disabled. PR-URL: https://github.com/nodejs/node/pull/18953 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-12-18stream: rm {writeable/readable}State.lengthCalvin Metcalf
As part of the readableState/writableState mega issue #445, this removes all of the references to .length on those properties and replaces them with a readableLength and writableLength getter. See: https://github.com/nodejs/node/issues/445 PR-URL: https://github.com/nodejs/node/pull/12857 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-12-15stream: add flow and buffer properties to streamsCalvin Metcalf
This adds computed properties to readable and writable streams to allow access to the readable buffer, the writable buffer, and flow state without accessing the readable or writable state. These are the only uses of readable and writable state in the docs so adding these work arounds allows them to be removed from the docs. This also updates net, http_client and http_server to use the new methods instead of manipulating readable and writable state directly. See: https://github.com/nodejs/node/issues/445 PR-URL: https://github.com/nodejs/node/pull/12855 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-11-15stream: remove usage of *State.highWaterMarkCalvin Metcalf
Replaced _readableState.highWaterMark with a .readableHighWaterMark getter and _writableState.highWaterMark with a .writableHighWaterMark getter. The getters are non-enumerable because they break some prototype manipulation that happen in the ecosystem. Ref: https://github.com/nodejs/node/issues/445. PR-URL: https://github.com/nodejs/node/pull/12860 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2017-05-22stream: add destroy and _destroy methods.Matteo Collina
Adds destroy() and _destroy() methods to Readable, Writable, Duplex and Transform. It also standardizes the behavior and the implementation of destroy(), which has been inconsistent in userland and core. This PR also updates all the subsystems of core to use the new destroy(). PR-URL: https://github.com/nodejs/node/pull/12925 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Calvin Metcalf <calvin.metcalf@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-03-10meta: restore original copyright headerJames M Snell
A prior io.js era commit inappropriately removed the original copyright statements from the source. This restores those in any files still remaining from that edit. Ref: https://github.com/nodejs/TSC/issues/174 Ref: https://github.com/nodejs/node/pull/10599 PR-URL: https://github.com/nodejs/node/pull/10155 Note: This PR was required, reviewed-by and approved by the Node.js Foundation Legal Committee and the TSC. There is no `Approved-By:` meta data.
2015-04-15node: allow multiple arguments passed to nextTickTrevor Norris
PR-URL: https://github.com/iojs/io.js/pull/1077 Reviewed-by: Colin Ihrig <cjihrig@gmail.com>
2015-01-21lib: use const to define constantscjihrig
This commit replaces a number of var statements throughout the lib code with const statements. PR-URL: https://github.com/iojs/io.js/pull/541 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-01-12Remove excessive copyright/license boilerplateisaacs
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
2014-11-22lib: turn on strict modeBen Noordhuis
Turn on strict mode for the files in the lib/ directory. It helps catch bugs and can have a positive effect on performance. PR-URL: https://github.com/node-forward/node/pull/64 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Fedor Indutny <fedor@indutny.com>
2014-09-05lib: improved forEach object performanceMajid Arif Siddiqui
Reviewed-by: Trevor Norris <trev.norris@gmail.com>
2013-01-17stdio: Set readable/writable flags properlyisaacs
Set the readable/writable flags properly in net streams that have a handle passed in (such as TTY streams). Fix #4606
2012-12-13streams2: Fix duplex no-half-open logicisaacs
2012-12-13streams2: ctor guards on Stream classesisaacs
2012-12-13streams2: The new stream base classesisaacs