stream.push()

stream.push('') Pushing a zero-byte string or Buffer (when not in Object mode) has an interesting side effect. Because it is a call to stream.push(), it will end the reading process. However, it does not add any data to the readable buffer, so there's nothing for a user to consume. Very rarely, there are cases where you have no data to provide now, but the consumer of your stream (or, perhaps, another bit of your own code) will know when to check again, by calling stream.read(0). In those cas

stream.PassThrough

Class: stream.PassThrough This is a trivial implementation of a Transform stream that simply passes the input bytes across to the output. Its purpose is mainly for examples and testing, but there are occasionally use cases where it can come in handy as a building block for novel sorts of streams.

stream.Duplex

Class: stream.Duplex A "duplex" stream is one that is both Readable and Writable, such as a TCP socket connection. Note that stream.Duplex is an abstract class designed to be extended with an underlying implementation of the stream._read(size) and stream._write(chunk, encoding, callback) methods as you would with a Readable or Writable stream class. Since JavaScript doesn't have multiple prototypal inheritance, this class prototypally inherits from Readable, and then parasitically from Writab

stream.Duplex

Class: stream.Duplex Duplex streams are streams that implement both the Readable and Writable interfaces. Examples of Duplex streams include: TCP sockets zlib streams crypto streams

socket event (http.ClientRequest)

Event: 'socket' function (socket) { } Emitted after a socket is assigned to this request.

SlowBuffer

Class: SlowBuffer Returns an un-pooled Buffer. In order to avoid the garbage collection overhead of creating many individually allocated Buffers, by default allocations under 4KB are sliced from a single larger allocated object. This approach improves both performance and memory usage since v8 does not need to track and cleanup as many Persistent objects. In the case where a developer may need to retain a small chunk of memory from a pool for an indeterminate amount of time, it may be appropr

SIGTSTP event (Readline)

Event: 'SIGTSTP' function () {} This does not work on Windows. Emitted whenever the input stream receives a ^Z, respectively known as SIGTSTP. If there is no SIGTSTP event listener present when the input stream receives a SIGTSTP, the program will be sent to the background. When the program is resumed with fg, the 'pause' and SIGCONT events will be emitted. You can use either to resume the stream. The 'pause' and SIGCONT events will not be triggered if the stream was paused before the progr

sign.update()

sign.update(data[, input_encoding]) Updates the Sign content with the given data, the encoding of which is given in input_encoding and can be 'utf8', 'ascii' or 'binary'. If encoding is not provided, and the data is a string, an encoding of 'utf8' is enforced. If data is a Buffer then input_encoding is ignored. This can be called many times with new data as it is streamed.

sign.sign()

sign.sign(private_key[, output_format]) Calculates the signature on all the data passed through using either sign.update() or sign.write(). The private_key argument can be an object or a string. If private_key is a string, it is treated as a raw key with no passphrase. If private_key is an object, it is interpreted as a hash containing two properties: key : {String} - PEM encoded private key passphrase : {String} - passphrase for the private key The output_format can specify one of 'binar

Sign

Class: Sign The Sign Class is a utility for generating signatures. It can be used in one of two ways: As a writable stream, where data to be signed is written and the sign.sign() method is used to generate and return the signature, or Using the sign.update() and sign.sign() methods to produce the signature. The crypto.createSign() method is used to create Sign instances. Sign objects are not to be created directly using the new keyword. Example: Using Sign objects as streams: const crypto