You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a particular reason that you're using this buffer implementation in Node.js?
I don't recommend passing this Buffer implementation into functions from Node.js core packages, like fs. These buffer instances will not be treated as real Node.js buffers because they fail a instanceof Buffer check. Things still might work out, since they're still a subclass of Uint8Array and they have a length property (so they're array-like), but instanceof won't ever work.
Let me know what problem you're trying to solve, and perhaps I can suggest a solution for your needs?
The following code throws an exception in node v6.x (and earlier):
The reason is that in
fs.js
in the node distribution, thereadSync()
function contains:See https://github.com/nodejs/node/blob/v6.x/lib/fs.js#L705
As a result, the function thinks it is being passed a string and the length ends up being passed in as the encoding.
I realize this is fixed in later version of node per your issue: nodejs/node#4530
Are there plans to allow this Buffer implemenation to work with the read calls in node v6?
The text was updated successfully, but these errors were encountered: