Closed elliott-wen closed 4 years ago
It turns out it is not a bug, I needed to wrap the typearray with buffer.from, but I just wonder whether it makes sense to automate this step, since strings are already auto wrapped.
BrowserFS emulates the Node API, so I thought that it should be clear that you need to use Buffer
, not ArrayBuffer
. I don't believe the Node API accepts bare ArrayBuffer
s (does it?). It accepts strings for legacy reasons.
As a result, I am marking this as WONTFIX.
Hi, there.
When I tried to execute the following simple script, it just threw an error.
TypeError: e.copy is not a function at e.n.writeSync (browserfs.rollup.js:3339) at e.n.write (browserfs.rollup.js:3282) at browserfs.rollup.js:2853 at e.open (browserfs.rollup.js:2975) at et.writeFile (browserfs.rollup.js:2837) at x.writeFile (browserfs.rollup.js:951) at Object.D..A. [as writeFile] (browserfs.rollup.js:1787)
at index.html:32
at passthrough.js:1
at Function.e.Create (passthrough.js:1)
Could you kindly enlighten me what's going on? Have tried 1.4.3. and 2.0.
Only happened when writting typearrays or arraybuffer, works fine for string