-
-
Notifications
You must be signed in to change notification settings - Fork 33k
Closed
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.v20.xIssues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.Issues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.
Description
Version
v21.7.1
Platform
Microsoft Windows NT 10.0.22631.0 x64
Subsystem
Class: Buffer
What steps will reproduce the bug?
const arraybuffer = new ArrayBuffer(4, { maxByteLength: 4096 });
const uint8array = new Uint8Array(arraybuffer);
uint8array.set([0,1,2,3]);
const buffer = Buffer.from(arraybuffer);
console.error(uint8array);
console.error(buffer);
arraybuffer.resize(8);
uint8array.set([4,5,6,7],4);
uint8array[0]=0xff;
console.error(uint8array);
console.error(buffer);
Output:
Uint8Array(4) [ 0, 1, 2, 3 ]
<Buffer 00 01 02 03>
Uint8Array(8) [
255, 1, 2, 3,
4, 5, 6, 7
]
<Buffer ff 01 02 03>
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
Expecting buffer to be resized and output to be:
<Buffer ff 01 02 03 04 05 06 07>
What do you see instead?
<Buffer ff 01 02 03>
Additional information
If the resolution to this is that Buffer isn't going to support ArrayBuffer.resize() that should be reflected in the documentation.
Metadata
Metadata
Assignees
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.v20.xIssues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.Issues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.