Converting a Buffer into a ReadableStream in Node.js

后端 未结 8 1179
借酒劲吻你
借酒劲吻你 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

    Here is a simple solution using streamifier module.

    const streamifier = require('streamifier');
    streamifier.createReadStream(new Buffer ([97, 98, 99])).pipe(process.stdout);
    

    You can use Strings, Buffer and Object as its arguments.

提交回复
热议问题