Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 73939ec

Browse filesBrowse files
zbjornsonItalo A. Casas
authored andcommitted
doc: clarify memory sharing behavior of buffer ctor
* Clarify that memory is always shared and never copied. * Fix wording that sounded like ArrayBuffer has a buffer property. PR-URL: #10778 Ref: #10770 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent f8b081b commit 73939ec
Copy full SHA for 73939ec

File tree

Expand file treeCollapse file tree

1 file changed

+16
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-14
lines changed
Open diff view settings
Collapse file

‎doc/api/buffer.md‎

Copy file name to clipboardExpand all lines: doc/api/buffer.md
+16-14Lines changed: 16 additions & 14 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,16 @@ deprecated: v6.0.0
348348
> [`Buffer.from(arrayBuffer[, byteOffset [, length]])`][`Buffer.from(arrayBuffer)`]
349349
> instead.
350350
351-
* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a [`TypedArray`] or
352-
[`ArrayBuffer`]
353-
* `byteOffset` {Integer} Where to start copying from `arrayBuffer`. **Default:** `0`
354-
* `length` {Integer} How many bytes to copy from `arrayBuffer`.
351+
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a
352+
[`TypedArray`].
353+
* `byteOffset` {Integer} Index of first byte to expose. **Default:** `0`
354+
* `length` {Integer} Number of bytes to expose.
355355
**Default:** `arrayBuffer.length - byteOffset`
356356

357-
When passed a reference to the `.buffer` property of a [`TypedArray`] instance,
358-
the newly created `Buffer` will share the same allocated memory as the
359-
[`TypedArray`].
357+
This creates a view of the [`ArrayBuffer`] without copying the underlying
358+
memory. For example, when passed a reference to the `.buffer` property of a
359+
[`TypedArray`] instance, the newly created `Buffer` will share the same
360+
allocated memory as the [`TypedArray`].
360361

361362
The optional `byteOffset` and `length` arguments specify a memory range within
362363
the `arrayBuffer` that will be shared by the `Buffer`.
@@ -719,15 +720,16 @@ A `TypeError` will be thrown if `array` is not an `Array`.
719720
added: v5.10.0
720721
-->
721722

722-
* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a [`TypedArray`] or
723-
[`ArrayBuffer`]
724-
* `byteOffset` {Integer} Where to start copying from `arrayBuffer`. **Default:** `0`
725-
* `length` {Integer} How many bytes to copy from `arrayBuffer`.
723+
* `arrayBuffer` {ArrayBuffer} An [`ArrayBuffer`] or the `.buffer` property of a
724+
[`TypedArray`].
725+
* `byteOffset` {Integer} Index of first byte to expose. **Default:** `0`
726+
* `length` {Integer} Number of bytes to expose.
726727
**Default:** `arrayBuffer.length - byteOffset`
727728

728-
When passed a reference to the `.buffer` property of a [`TypedArray`] instance,
729-
the newly created `Buffer` will share the same allocated memory as the
730-
[`TypedArray`].
729+
This creates a view of the [`ArrayBuffer`] without copying the underlying
730+
memory. For example, when passed a reference to the `.buffer` property of a
731+
[`TypedArray`] instance, the newly created `Buffer` will share the same
732+
allocated memory as the [`TypedArray`].
731733

732734
Example:
733735

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.