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
the Buffer's ArrayBuffer is always 8192 in length, with a byteLength & length of whatever the original array length was, and a byteOffset = 4568 or something like it.
Instance method toString() outputs the correct values anyway
Instance method entries() also outputs the correct values
Does not occur when the same code is compiled into JS and then executed.
The workaround is to use Buffer.alloc with a TypedArray. Example:
const uint8array = new Uint8Array([0,1,2,3,5,8,13]);
const buf = Buffer.alloc(uint8array.length, uint8array)
The above results in the expected values in the Buffer's ArrayBuffer, with a length and byteLength of 7, byteOffset = 0 as expected.
Acknowledgements
Minimal reproduction URL
https://gist.github.com/wilwade/66bc4614fdaa3a349c5f25b7164d12bc
Problem & expected behavior (under 200 words)
tsx Version: v4.19.1, v4.10.2
Note: This ALSO happens with ts-node v10.9.2
tldr: When using a buffer, the
buffer.buffer
is getting filled up with stuff it should not be.Bugs are expected to be fixed by those affected by it
Compensating engineering work will speed up resolution and support the project
The text was updated successfully, but these errors were encountered: