Skip to content

Commit

Permalink
doc: document buffer.buffer property
Browse files Browse the repository at this point in the history
Buffer objects expose the underlying `Uint8Array`'s `buffer` property
by default. This patch formally documents it.

PR-URL: #8332
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
  • Loading branch information
thefourtheye committed Jan 18, 2017
1 parent 16e3cf6 commit 03d440e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions doc/api/buffer.md
Expand Up @@ -879,6 +879,19 @@ for (let i = 0; i < str.length ; i++) {
console.log(buf.toString('ascii'));
```

### buf.buffer

The `buffer` property references the underlying `ArrayBuffer` object based on
which this Buffer object is created.

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

console.log(buffer.buffer === arrayBuffer);
// Prints: true
```

### buf.compare(target[, targetStart[, targetEnd[, sourceStart[, sourceEnd]]]])
<!-- YAML
added: v0.11.13
Expand Down

0 comments on commit 03d440e

Please sign in to comment.