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

doc: add Buffer#subarray() and add note about Uint8Array#slice() #28101

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -1977,7 +1977,9 @@ offset and cropped by the `start` and `end` indices.

This is the same behavior as `buf.subarray()`.

Note that this method is not compatible with the `Uint8Array#slice()`, which is a superclass of `Buffer`. If a copy of slice is needed, use `Uint8Array.prototype.slice` directly.
Note that this method is not compatible with the `Uint8Array.prototype.slice()`,
gfx marked this conversation as resolved.
Show resolved Hide resolved
which is a superclass of `Buffer`. If a copy of the slice is needed, use
gfx marked this conversation as resolved.
Show resolved Hide resolved
`Uint8Array.prototype.slice` directly.
gfx marked this conversation as resolved.
Show resolved Hide resolved

```js
const buf = Buffer.from('buffer');
Expand Down