Skip to content

Commit be89608

Browse files
tsabolovcodebytere
authored andcommitted
doc: correct getting an ArrayBuffer's length
`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 <[email protected]> Reviewed-By: Yongsheng Zhang <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent cdc6255 commit be89608

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/api/buffer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ changes:
384384
[`SharedArrayBuffer`][] or the `.buffer` property of a [`TypedArray`][].
385385
* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`.
386386
* `length` {integer} Number of bytes to expose.
387-
**Default:** `arrayBuffer.length - byteOffset`.
387+
**Default:** `arrayBuffer.byteLength - byteOffset`.
388388

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

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

0 commit comments

Comments
 (0)