-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
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
Unclear docs on copying/sharing memory for Buffer.from(arrayBuffer) #10770
Comments
addaleax
added
buffer
Issues and PRs related to the buffer subsystem.
doc
Issues and PRs related to the documentations.
labels
Jan 12, 2017
You’re right, the docs are not correct. Go for it! :) If you need a better word to use instead of |
zbjornson
added a commit
to zbjornson/node
that referenced
this issue
Jan 13, 2017
* Clarify that memory is always shared and never copied. * Fix wording that sounded like ArrayBuffer has a buffer property. Fixes nodejs#10770
2 tasks
italoacasas
pushed a commit
to italoacasas/node
that referenced
this issue
Jan 18, 2017
* Clarify that memory is always shared and never copied. * Fix wording that sounded like ArrayBuffer has a buffer property. PR-URL: nodejs#10778 Ref: nodejs#10770 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
italoacasas
pushed a commit
to italoacasas/node
that referenced
this issue
Jan 23, 2017
* Clarify that memory is always shared and never copied. * Fix wording that sounded like ArrayBuffer has a buffer property. PR-URL: nodejs#10778 Ref: nodejs#10770 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
italoacasas
pushed a commit
to italoacasas/node
that referenced
this issue
Jan 24, 2017
* Clarify that memory is always shared and never copied. * Fix wording that sounded like ArrayBuffer has a buffer property. PR-URL: nodejs#10778 Ref: nodejs#10770 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
italoacasas
pushed a commit
to italoacasas/node
that referenced
this issue
Jan 27, 2017
* Clarify that memory is always shared and never copied. * Fix wording that sounded like ArrayBuffer has a buffer property. PR-URL: nodejs#10778 Ref: nodejs#10770 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
andrew749
pushed a commit
to michielbaird/node
that referenced
this issue
Jul 19, 2017
* Clarify that memory is always shared and never copied. * Fix wording that sounded like ArrayBuffer has a buffer property. PR-URL: nodejs/node#10778 Ref: nodejs/node#10770 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This was referenced Nov 28, 2023
This was referenced Nov 29, 2023
This was referenced Nov 29, 2023
This was referenced Nov 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The docs for
Buffer.from(arrayBuffer)
use the word copy/copying:But as far as I can tell, it always references a subarray and never copies.
The line below it:
is also confusing -- I think that's meant as an example to emphasize the point that it's shared memory, but to me it sounds like there's a situation when it would copy and not share (e.g.
Buffer.from(new ArrayBuffer(8))
.Trivial change but wanted to make sure my understanding was correct before submitting a PR. Something like: "byteOffset - element to begin at", "length - number of elements to include" and adding "For example" to the "when passed a reference..." bit.
The text was updated successfully, but these errors were encountered: