一、stream
Node.js
中有四种基本的流类型:
- Readable: 可读的流 (例如 fs.createReadStream()).
- Writable: 可写的流 (例如 fs.createWriteStream()).
- Duplex: 可读写的流 (例如 net.Socket).
- Transform: 在读写过程中可以修改和变换数据的 Duplex 流 (例如 zlib.createDeflate()).
二、stream.finished(stream[, options], callback)
四、stream.pipeline(streams, callback)
五、stream.compose(...streams)
六、stream.Readable.from(iterable[, options])
七、stream.Readable.fromWeb(readableStream[, options])
八、stream.Readable.isDisturbed(stream)
九、stream.isErrored(stream)
十、stream.isReadable(stream)
十一、stream.Readable.toWeb(streamReadable[, options])
十二、stream.Writable.fromWeb(writableStream[, options])
十三、stream.Writable.toWeb(streamWritable)
十四、stream.Duplex.from(src)
十五、stream.Duplex.fromWeb(pair[, options])
十六、stream.Duplex.toWeb(streamDuplex)
十七、stream.addAbortSignal(signal, stream)
十八、stream.getDefaultHighWaterMark(objectMode)
十九、stream.setDefaultHighWaterMark(objectMode, value)
参考资料
Node.js 中文网
- 一、stream
- 二、stream.finished(stream[, options], callback)
- 三、stream.pipeline(source[, ...transforms], destination, callback)
- 四、stream.pipeline(streams, callback)
- 五、stream.compose(...streams)
- 六、stream.Readable.from(iterable[, options])
- 七、stream.Readable.fromWeb(readableStream[, options])
- 八、stream.Readable.isDisturbed(stream)
- 九、stream.isErrored(stream)
- 十、stream.isReadable(stream)
- 十一、stream.Readable.toWeb(streamReadable[, options])
- 十二、stream.Writable.fromWeb(writableStream[, options])
- 十三、stream.Writable.toWeb(streamWritable)
- 十四、stream.Duplex.from(src)
- 十五、stream.Duplex.fromWeb(pair[, options])
- 十六、stream.Duplex.toWeb(streamDuplex)
- 十七、stream.addAbortSignal(signal, stream)
- 十八、stream.getDefaultHighWaterMark(objectMode)
- 十九、stream.setDefaultHighWaterMark(objectMode, value)
- 参考资料