Skip to content
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

buffer: deprecate parent property #8332

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,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 Expand Up @@ -1314,6 +1327,12 @@ buf = buf.slice(0, 5);
console.log(buf.length);
```

### buf.parent

> Stability: 0 - Deprecated: Use [`buf.buffer`] instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might add here a quick comment saying something like:

The `buf.parent` property is a deprecated alias for `buf.buffer`.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack!

The `buf.parent` property is a deprecated alias for `buf.buffer`.

### buf.readDoubleBE(offset[, noAssert])
### buf.readDoubleLE(offset[, noAssert])
<!-- YAML
Expand Down Expand Up @@ -2414,6 +2433,7 @@ console.log(buf);
```

[`buf.compare()`]: #buffer_buf_compare_target_targetstart_targetend_sourcestart_sourceend
[`buf.buffer`]: #buffer_buf_buffer
[`buf.entries()`]: #buffer_buf_entries
[`buf.indexOf()`]: #buffer_buf_indexof_value_byteoffset_encoding
[`buf.fill()`]: #buffer_buf_fill_value_offset_end_encoding
Expand Down