Skip to content
0

node:stream

详见 Stream流

pipeline

通过 pipeline 可以实现 pipe 工具,方便我们控制流的流动,借助 promisify,可以轻松进行同步操作

import { pipeline } from 'node:stream'
import { promisify } from 'node:util'

const pipe = promisify(pipeline)

await pipe(stdin, someStream ,stdout)

PassThrough

import { PassThrough } from 'node:stream'

可读可写流,SSE 场景非常适合使用,例如这个例子

Released under the MIT License.