The Stream docs state that Duplex Streams "are streams that implement both the Readable and Writable interfaces" and Transform Streams "are Duplex streams where the output is in some way computed from the input." Unfortunately, the docs do not describe what Transform streams provide above and beyond Duplex streams.
Are there any differences between the two? When would you use one over the other?
_transform
method, which has the same signature as a Writeable Stream's_write
method, so this implies that what's read depends on what's written. One implication of this is that you can't specify the number of bytes to be read at a time like with_read
, it's simply the number of bytes you wrote. On the other hand, with Duplex streams, you could theoretically make a_read
which depends on_write
, or even have the_write
which depend on_read
, but no read/write linking is implied by the Duplex Stream class itself. – Crowley