-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
doc: note that buf.buffer's contents might differ #29651
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
This bit me in a personal project since I had no reason to read the `buf.byteOffset` docs, so point readers there explicitly.
@@ -1025,6 +1025,9 @@ console.log(buf.toString('ascii')); | |||
* {ArrayBuffer} The underlying `ArrayBuffer` object based on | |||
which this `Buffer` object is created. | |||
|
|||
This `ArrayBuffer` is not guaranteed to correspond exactly to the original | |||
`Buffer`. See the notes on `buf.byteOffset` for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`Buffer`. See the notes on `buf.byteOffset` for details. | |
`Buffer`. See the notes on [`buf.byteOffset`][] for details. |
Add the following at the bottom:
[`buf.byteOffset`]: #buffer_buf_byteoffset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a better approach is to say that the Buffer
is a view over a subset of the ArrayBuffer
. It will correspond to that subset only starting at the byteOffset
.
@nodejs/buffer @nodejs/documentation |
This seems to have stalled, so I'm going to close it. If you plan on working revising this to get it landed, please re-open or leave a comment. Thanks! |
Actually, I take it back. Re-opening.... |
This bit me in a personal project since I had no reason to read the `buf.byteOffset` docs, so point readers there explicitly. PR-URL: #29651 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in 5833cfd |
This bit me in a personal project since I had no reason to read the `buf.byteOffset` docs, so point readers there explicitly. PR-URL: #29651 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This bit me in a personal project since I had no reason to read the `buf.byteOffset` docs, so point readers there explicitly. PR-URL: #29651 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This bit me in a personal project since I had no reason to read the `buf.byteOffset` docs, so point readers there explicitly. PR-URL: #29651 Reviewed-By: Anna Henningsen <anna@addaleax.net>
This bit me in a personal project since I had no reason to read the
buf.byteOffset
docs, so point readers there explicitly.Checklist
- [ ]make -j4 test
(UNIX), orvcbuild test
(Windows) passes- [ ] tests and/or benchmarks are included