From be896083d86aace72cd5f5b6166af8d966aeca96 Mon Sep 17 00:00:00 2001 From: tsabolov Date: Tue, 4 Feb 2020 11:51:13 +0100 Subject: [PATCH] doc: correct getting an ArrayBuffer's length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `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: https://github.com/nodejs/node/pull/31632 Reviewed-By: Anna Henningsen Reviewed-By: Yongsheng Zhang Reviewed-By: Gus Caplan Reviewed-By: James M Snell Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- doc/api/buffer.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index f033f8a20ae9dc..0d7dee9df4528a 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -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 @@ -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