Write stream into buffer object

Viewed 10333

I have a stream that is being read from an audio source and I'm trying to store it into a Buffer. From the documentation that I've read, you are able to pipe the stream into one using fs.createWriteStream(~buffer~) instead of a file path.

I'm doing this currently as:

const outputBuffer = Buffer.alloc(150000)
const stream = fs.createWriteStream(outputBuffer)

but when I run it, it throws an error saying that the Path: must be a string without null bytes for the file system call.

If I'm misunderstanding the docs or missing something obvious please let me know!

1 Answers
Related