Skip to content

Commit

Permalink
doc: note that buf.buffer's contents might differ
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
strugee authored and addaleax committed Nov 30, 2019
1 parent 5a6f836 commit cbd5026
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

```js
const arrayBuffer = new ArrayBuffer(16);
const buffer = Buffer.from(arrayBuffer);
Expand Down

0 comments on commit cbd5026

Please sign in to comment.