stream.Duplex.from(src)


用于创建双工流的实用方法。

🌐 A utility method for creating duplex streams.

  • Stream 将可写流转换为可写的 Duplex,将可读流转换为可读的 Duplex
  • Blob 转换为可读的 Duplex
  • string 转换为可读的 Duplex
  • ArrayBuffer 转换为可读的 Duplex
  • AsyncIterable 可以转换为可读的 Duplex。不能产生 null
  • AsyncGeneratorFunction 会转换为可读/可写的转换流 Duplex。必须将源 AsyncIterable 作为第一个参数。不能生成 null
  • AsyncFunction 会转换为可写的 Duplex。必须返回 nullundefined
  • Object ({ writable, readable })readablewritable 转换为 Stream,然后将它们组合成 Duplex,其中 Duplex 会写入 writable 并从 readable 读取。
  • Promise 会转换为可读的 Duplex。值 null 会被忽略。
  • 返回:<stream.Duplex>