事件:'pipe'
\Event: 'pipe'
新增于: v0.9.4
-
src<stream.Readable> 通过管道传输到此可写的源流\
src<stream.Readable> source stream that is piping to this writable
当在可读流上调用 stream.pipe() 方法将此可写流添加到其目标集时,则触发 'pipe' 事件。
\The 'pipe' event is emitted when the stream.pipe() method is called on
a readable stream, adding this writable to its set of destinations.
const writer = getWritableStreamSomehow();
const reader = getReadableStreamSomehow();
writer.on('pipe', (src) => {
console.log('Something is piping into the writer.');
assert.equal(src, reader);
});
reader.pipe(writer);