summaryrefslogtreecommitdiff
path: root/lib/stream.js
Commit message (Collapse)AuthorAgeFilesLines
* meta: restore original copyright headerJames M Snell2017-03-101-0/+21
| | | | | | | | | | | | | | | 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.
* stream: move legacy to lib/internal diryorkie2017-02-011-96/+3
| | | | | | | | Improve readability of lib/stream.js by moving the legacy abstract Stream into lib/internal/streams/legacy.js. PR-URL: https://github.com/nodejs/node/pull/8197 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
* lib,src: remove usage of events.EventEmitterSakthipriyan Vairamani2015-09-231-1/+1
| | | | | | | | | | | The `events` module already exports `EventEmitter` constructor function So, we don't have to use `events.EventEmitter` to access it. Refer: https://github.com/nodejs/node/pull/2896 PR-URL: https://github.com/nodejs/node/pull/2921 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
* events,lib: don't require EE#listenerCount()Jeremiah Senkpiel2015-09-061-1/+1
| | | | | | | | | | | | | Now parts of our public and public-ish APIs fall back to old-style listenerCount() if the emitter does not have a listenerCount function. Fixes: https://github.com/nodejs/node/issues/2655 Refs: 8f58fb92fff904a6ca58fd0df9ee5a1816e5b84e PR-URL: https://github.com/nodejs/node/pull/2661 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* events: deprecate static listenerCount functionSakthipriyan Vairamani2015-08-201-1/+1
| | | | | | | | | | As per the discussion in #734, this patch deprecates the usage of `EventEmitter.listenerCount` static function in the docs, and introduces the `listenerCount` function in the prototype of `EventEmitter` itself. PR-URL: https://github.com/nodejs/node/pull/2349 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
* lib,test: fix whitespace issuesRoman Reiss2015-06-151-1/+0
| | | | | PR-URL: https://github.com/nodejs/io.js/pull/1971 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* lib: reduce util.is*() usagecjihrig2015-01-311-1/+1
| | | | | | | | | | | | Many of the util.is*() methods used to check data types simply compare against a single value or the result of typeof. This commit replaces calls to these methods with equivalent checks. This commit does not touch calls to the more complex methods (isRegExp(), isDate(), etc.). Fixes: https://github.com/iojs/io.js/issues/607 PR-URL: https://github.com/iojs/io.js/pull/647 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
* lib: use const to define constantscjihrig2015-01-211-2/+2
| | | | | | | | 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>
* Remove excessive copyright/license boilerplateisaacs2015-01-121-21/+0
| | | | | | | 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.
* lib: turn on strict modeBen Noordhuis2014-11-221-0/+2
| | | | | | | | | 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>
* src: Replace macros with util functionsisaacs2013-08-011-1/+1
|
* lib: macro-ify type checksBen Noordhuis2013-07-241-1/+1
| | | | | Increases the grep factor. Makes it easier to harmonize type checks across the code base.
* events: add check for listeners lengthTrevor Norris2013-03-011-4/+4
| | | | | | Ability to return just the length of listeners for a given type, using EventEmitter.listenerCount(emitter, event). This will be a lot cheaper than creating a copy of the listeners array just to check its length.
* streams2: The new stream base classesisaacs2012-12-131-4/+17
|
* streams: remove useless lineSoarez2012-10-211-1/+0
| | | | | The removed line was removing a calllback that was never setup in first place. 016afe2 forgot to remove this.
* streams: fix pipe is destructed by 'end' from destinationkoichik2012-10-031-1/+0
|
* stream.pipe: Don't call destroy() unless it's a functionisaacs2012-09-101-1/+1
|
* stream: don't call `cleanup` twice on `end` and `close`Maciej Małecki2012-05-281-6/+0
|
* Remove support for multi-source pipe()Felix Geisendörfer2011-11-221-19/+1
| | | | | | | This reverts 6c5b31bd which had too few use cases, too much complexity, and can be handled in user-land by using `{end: false}`. Closes #1996
* throw from stdout.end and stderr.endIgor Zinkovsky2011-11-101-1/+1
|
* Directly export the Stream constructor.Nathan Rajlich2011-10-241-1/+3
| | | | | | | Also setting up a circular reference back to the stream as `Stream.Stream`, for backwards-compatibility. Fixes #1933
* Remove resume and pause eventsRyan Dahl2011-10-241-31/+6
| | | | Too complex; unnecessary.
* Close #1303 Stream.pipe returns the destinationElijah Insua2011-07-141-0/+3
| | | | | | | | | Squashed: * Simple change to make Stream.pipe(destination) return the destination Stream * Test: ensure Stream.pipe(destination) returns the destination Stream * updated Stream.pipe() documentation to reflect that it now returns the destination stream
* Fix error handling bug in stream.pipe()Felix Geisendörfer2011-05-241-1/+1
| | | | | | | | | | | | | | | | | | Problem: Since stream.pipe() is registering it's own error handlers on the source and destination stream, it needs to replicate the EventEmitter 'error' emitting semantics of throwing an error if there are no other listeners. However, there was a off-by-one error because the check for remaining listeners was done after cleanup() which means the pipe's own listener was no longer included. This would cause 'error' events on either the dest or the source to throw if there was one other error listener, and while swallowing the 'error' event if there was no other listener. Solution: I added a test demonstrating the two issues and fixed the problem by correcting the off-by-one error. Fixes #1095.
* cleartextstream.destroy() should destroy socket.Ryan Dahl2011-05-021-2/+20
| | | | | | This fixes a critical bug see in MJR's production. Very difficult to build a test case. Sometimes HTTPS server gets sockets that are hanging in a half-duplex state.
* Better stream.pipe() tracking.isaacs2011-04-271-25/+43
| | | | | | | | | | | | | | | | | | | | | | | | This commit does three things: 1. Uses an exposed counter rather than a hidden array for tracking dest streams that may have multiple inputs. This allows for significantly faster lookups, since the counter can be checked in constant time rather than searching an array for the dest object. (A proper O(1) WeakMap would be better, but that may have to wait for Harmony.) 2. Calls the 'end' event logic when there is an 'error' event on the source object (and then throws if there are no other error listeners.) This is important, because otherwise 'error' events would lead to memory leaks. 3. Clean up the style a bit. Function Declarations are not allowed within blocks in ES strict. Prefer Function Declarations to Function Expressions, because hoisting allows for more expressive ordering of logic. Downside: It adds "_pipeCount" as part of the Stream API. It'll work fine if the member is missing, but if anyone tries to use it for some other purpose, it can mess things up.
* Fix: Multiple pipes to the same stream were brokenFelix Geisendörfer2011-04-141-8/+21
| | | | | | | | | | When creating multiple .pipe()s to the same destination stream, the first source to end would close the destination, breaking all remaining pipes. This patch fixes the problem by keeping track of all open pipes, so that we only call end on destinations that have no more sources piping to them. closes #929
* Fix listener leak in stream.pipe()Mikeal Rogers2011-03-281-12/+30
|
* Update copyright headersRyan Dahl2011-03-141-0/+21
|
* Add 'pipe' eventMikeal Rogers2011-02-091-0/+2
|
* Revert "Add optional filters to stream.pipe()"Ryan Dahl2011-01-011-41/+2
| | | | This reverts commit 24aded078fd6838d2f21934e57c7cc8dfd7303d1.
* Add optional filters to stream.pipe()Ryan Dahl2010-12-171-2/+41
|
* lintRyan Dahl2010-12-011-14/+14
|
* more lintRyan Dahl2010-12-011-1/+1
|
* Fix test-securepair-serverRyan Dahl2010-11-231-3/+5
|
* stream.pipe should remove listeners on dest closeRyan Dahl2010-11-201-6/+19
|
* Soft migration of sys -> util, Removal of deprecated utils module.Micheil Smith2010-10-111-2/+2
|
* pipe-test fixesRyan Dahl2010-10-101-1/+1
|
* clean up options.end code - wasn't workingRyan Dahl2010-10-101-3/+1
|
* Add Stream base class with stream.pipeRyan Dahl2010-10-101-0/+57