可写流


🌐 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');