Skip to content

Commit

Permalink
doc: correct getting an ArrayBuffer's length
Browse files Browse the repository at this point in the history
`ArrayBuffer` instances do not have `.length` property.
Instead they have `.byteLength` property.
Fixed that in the description of
`new Buffer(arrayBuffer[, byteOffset[, length]])` and
`Buffer.from(arrayBuffer[, byteOffset[, length]])`.

PR-URL: #31632
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
tsabolov authored and codebytere committed Feb 17, 2020
1 parent 13c256d commit 2991e7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ changes:
[`SharedArrayBuffer`][] or the `.buffer` property of a [`TypedArray`][].
* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`.
* `length` {integer} Number of bytes to expose.
**Default:** `arrayBuffer.length - byteOffset`.
**Default:** `arrayBuffer.byteLength - byteOffset`.

This creates a view of the [`ArrayBuffer`][] or [`SharedArrayBuffer`][] without
copying the underlying memory. For example, when passed a reference to the
Expand Down Expand Up @@ -830,7 +830,7 @@ added: v5.10.0
[`SharedArrayBuffer`][], or the `.buffer` property of a [`TypedArray`][].
* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`.
* `length` {integer} Number of bytes to expose.
**Default:** `arrayBuffer.length - byteOffset`.
**Default:** `arrayBuffer.byteLength - byteOffset`.

This creates a view of the [`ArrayBuffer`][] without copying the underlying
memory. For example, when passed a reference to the `.buffer` property of a
Expand Down

0 comments on commit 2991e7c

Please sign in to comment.