Now that highWaterMark increases when there are large reads, this
greatly reduces the number of calls necessary to _read(size), assuming
that _read actually respects the size argument.
The first example uses Readable, and shows the use of
readable.unshift(). The second uses the Transform class, showing that
it's much simpler in this case.
It seems like a good idea on the face of it, but lowWaterMarks are
actually not useful, and in practice should always be set to zero.
It would be worthwhile for writers if we actually did some kind of
writev() type of thing, but actually this just delays calling write()
and the overhead of doing a bunch of Buffer copies is not worth the
slight benefit of calling write() fewer times.
We detect for non-string and non-buffer values in onread and
turn the stream into an "objectMode" stream.
If we are in "objectMode" mode then howMuchToRead will
always return 1, state.length will always have 1 appended
to it when there is a new item and fromList always takes
the first value from the list.
This means that for object streams, the n in read(n) is
ignored and read() will always return a single value
Fixed a bug with unpipe where the pipe would break because
the flowing state was not reset to false.
Fixed a bug with sync cb(null, null) in _read which would
forget to end the readable stream
Starting a line with `**bold**` text makes it think that it's a link,
and get confused.
This should really be fixed properly in the doc generator, but for now,
it's not a major issue. It's probably just a matter of updating marked.
Mostly quite minor edits. Those possibly of more interest are:
emitter.setMaxListeners(n)
That the limit is per event name for an emitter.
fs.readlink()
Not a path, but rather the symbolic link's string value, which
would be at best a partial path, certainly not a 'resolvedPath'
global.__filename
This may be "well-known" but this is a full path to the module
that referencing code is running in. It is not the main program's
path, unless you are in the main program. Each module knows only
its own path.
server.listen(port,...)
I actually needed this functionality... "gimme just _any_ next port"
stream.end()
stream.destroy()
Yeah, everybody knows what happens to the queued data, but let's
make it *really* explicit for the first readers.
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