support parsing ArrayBuffer and arraybuffer-view's (typed arrays)
jimmywarting opened this issue · 0 comments
jimmywarting commented
I tried to store the torrent.torrentFile
which is a instance of Uint8Array
in the browser (not a Buffer)
indexedDB storage accepts cloneable object such as Boolean, ArrayBuffer, Typed Arrays, etc But what is not cloneable is a Node Buffer.
So when I tried to add a torrent with a client.add(uint8arr)
it throw a error saying
Error: Invalid torrent identifier
Node's Buffer.isBuffer(obj)
don't see typed arrays (or ArrayBuffer) as a buffer.
could you make it so that it can recognize typed array also?
Working with Node's buffer can be a bit of a pain in the ass when it comes to cross web/node environment and I think the use of nodes-buffer is big dependency when ArrayBuffers can do the job at least as good in both environment