Skip to content

buffer: make Buffer work with resizable ArrayBuffer#55377

Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom
jasnell:buffer-with-resizable-arraybuffer
Oct 15, 2024
Merged

buffer: make Buffer work with resizable ArrayBuffer#55377
nodejs-github-bot merged 1 commit intonodejs:mainfrom
jasnell:buffer-with-resizable-arraybuffer

Conversation

@jasnell
Copy link
Copy Markdown
Member

@jasnell jasnell commented Oct 13, 2024

For release notes:

When a Buffer is created using a resizable ArrayBuffer, the Buffer length will now correctly change as the underlying ArrayBuffer size is changed.

const ab = new ArrayBuffer(10, { maxByteLength: 20 });
const buffer = Buffer.from(ab);
console.log(buffer.byteLength); 10
ab.resize(15);
console.log(buffer.byteLength); 15
ab.resize(5);
console.log(buffer.byteLength); 5

Fixes: #52195

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. buffer Issues and PRs related to the buffer subsystem. notable-change PRs with changes that should be highlighted in changelogs. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Class: Buffer do not follow when the underlying ArrayBuffer is resized

7 participants