可写流
¥Writable streams
可写流是数据写入目标的抽象。
¥Writable streams are an abstraction for a destination to which data is written.
Writable 流的示例包括:
¥Examples of Writable streams include:
其中一些示例实际上是实现 Writable 接口的 Duplex 流。
¥Some of these examples are actually Duplex streams that implement the
Writable interface.
所有的 Writable 流都实现了 stream.Writable 类定义的接口。
¥All Writable streams implement the interface defined by the
stream.Writable class.
虽然 Writable 流的特定实例可能以各种方式不同,但所有的 Writable 流都遵循相同的基本使用模式,如下例所示:
¥While specific instances of Writable streams may differ in various ways,
all Writable streams follow the same fundamental usage pattern as illustrated
in the example below:
const myStream = getWritableStreamSomehow();
myStream.write('some data');
myStream.write('some more data');
myStream.end('done writing data');