Converting a Buffer into a ReadableStream in Node.js

后端 未结 8 1250
借酒劲吻你
借酒劲吻你 2020-11-27 16:09

I\'m fairly new to Buffers and ReadableStreams, so maybe this is a stupid question. I have a library that takes as input a ReadableStream, but my input is just

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 16:37

    For nodejs 10.17.0 and up:

    const stream = Readable.from(myBuffer.toString());
    

提交回复
热议问题