Closed DamonOehlman closed 10 years ago
You can't return Uint8Array
because node streams require buffers. They actually do a Buffer.isBuffer
check.
However, if you want to avoid the array copy that comes with calling new Buffer
in your code here, then you can use typedarray-to-buffer
.
I'm planning to use filestream
in create-torrent to make it work in the browser with browserify, so thanks for writing this excellent module. Let me know if you'd like me to send a PR to add typedarray-to-buffer
.
OK - I think this is all done, but let me know if I've missed anything :)
All you changes look great, except for the one use of instanceof Buffer
which will not work reliably in the browser. I left a comment on the specific line. Read this for context.
Hope your holidays were great! Thanks for merging :+1:
Thanks @feross - made that change. And, yes holidays were awesome :)
Currently I make sure data is pushed into a node compatible
Buffer
at the stream interface boundaries. Would be interesting to see if this is actually required, and whether just using aUint8Array
would suffice.I've had a quick look at this, in combination with testing with the rtc-dcstream module but has witnessed a few strange effects so I'm leaving it as is for now...