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 <anna@addaleax.net>
  • Loading branch information
strugee authored and targos committed Dec 5, 2019
1 parent 27f7f89 commit 1818d9c
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 1818d9c

Please sign in to comment.