Skip to content

Commit 513d0fe

Browse files
committed
fixup! fixup! doc: clarify array args to Buffer.from()
1 parent 48769ec commit 513d0fe

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
@@ -1121,8 +1121,7 @@ const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
11211121
If `array` is an `Array`-like object (that is, one with a `length` property of
11221122
type `number`), it is treated as if it is an array, unless it is a `Buffer` or a
11231123
`Uint8Array`. This means all other `TypedArray` variants get treated as an
1124-
`Array`. To create a `Buffer` from the underlying `ArrayBuffer`, use the
1125-
`.buffer` property directly.
1124+
`Array`. To create a `Buffer` from the bytes backing a `TypedArray, use [`Buffer.copyBytesFrom()`][].
11261125

11271126
A `TypeError` will be thrown if `array` is not an `Array` or another type
11281127
appropriate for `Buffer.from()` variants.
@@ -5496,6 +5495,7 @@ introducing security vulnerabilities into an application.
54965495
[`Buffer.allocUnsafe()`]: #static-method-bufferallocunsafesize
54975496
[`Buffer.allocUnsafeSlow()`]: #static-method-bufferallocunsafeslowsize
54985497
[`Buffer.concat()`]: #static-method-bufferconcatlist-totallength
5498+
[`Buffer.copyBytesFrom()`]: #static-method-buffercopybytesfromview-offset-length
54995499
[`Buffer.from(array)`]: #static-method-bufferfromarray
55005500
[`Buffer.from(arrayBuf)`]: #static-method-bufferfromarraybuffer-byteoffset-length
55015501
[`Buffer.from(buffer)`]: #static-method-bufferfrombuffer

0 commit comments

Comments
 (0)