node.js - Write stream into buffer object -
i have stream being read audio source , i'm trying store buffer. documentation i've read, able pipe stream 1 using fs.createwritestream(~buffer~) instead of file path.
i'm doing as:
const outputbuffer = buffer.alloc(150000) const stream = fs.createwritestream(outputbuffer) but when run it, throws error saying path: must string without null bytes file system call.
if i'm misunderstanding docs or missing obvious please let me know!
the first parameter fs.createwritestream() filename read. why receive particular error.
there no way read stream directly existing buffer. there a node ep support this, more or less died off because there potential gotchas it.
for need either copy bytes manually or if don't want node allocate buffers, need manually call fs.open(), fs.read() (this method allows pass in buffer instance, along offset), , fs.close().
Comments
Post a Comment