We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Buffer.from
> Buffer.from(Buffer.from('1234567890'), 1, 3); <Buffer 31 32 33 34 35 36 37 38 39 30> > Buffer.from(Buffer.from('1234567890').buffer, 0, 3); <Buffer 78 dc bf> > Buffer.from('1234567890').buffer ArrayBuffer { byteLength: 8192 }
.buffer
These are questions, but I believe they correspond to either bugs in the docs or implementation.
See also #7134 where .slice is the recommended solution, but the underlying problem isn't resolved.
.slice
The text was updated successfully, but these errors were encountered:
There is no bug. Truncation only works if first argument is ArrayBuffer, not Buffer.
ArrayBuffer
Buffer
What does .buffer mean? It seems to allow the truncation to occur but has the wrong bytes in it.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/buffer
Sorry, something went wrong.
@vkurchatkin it's returning the wrong bytes when I use the .buffer in the second invocation.
@ubershmekel I think it is possibly connected with Buffer.poolSize and internal preallocation: https://nodejs.org/api/buffer.html#buffer_class_property_buffer_poolsize
Buffer.poolSize
No branches or pull requests
Buffer.from
just copies the original buffer..buffer
mean? It seems to allow the truncation to occur but has the wrong bytes in it.These are questions, but I believe they correspond to either bugs in the docs or implementation.
See also #7134 where
.slice
is the recommended solution, but the underlying problem isn't resolved.The text was updated successfully, but these errors were encountered: