pipes

1. PIPE:

Connecting two streams by writing to one stream what is being read from another.

In Node you pipe from a Readable stream to a Writable stream.

It could be a chain, a chunk from a readable stream is sent to a writable stream. If this stream is also readable then the chunk can be piped to another writable stream. stream -> stream-> stream .... a chain.

readableSrc.pipe(writableDest);

2. Method Chaining:

A method returns an object so we can keep calling more methods.

Sometimes it returns the parent object(called 'cascading') and sometimes some other object.

Last updated

Was this helpful?