Skip to content

Commit

Permalink
doc: add missing return values in buffer docs
Browse files Browse the repository at this point in the history
PR-URL: #55273
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Jacob Smith <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
karlhorky authored and ruyadorno committed Nov 27, 2024
1 parent 6e7b33a commit 23d89da
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ changes:
with. **Default:** `0`.
* `encoding` {string} If `fill` is a string, this is its encoding.
**Default:** `'utf8'`.
* Returns: {Buffer}

Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the
`Buffer` will be zero-filled.
Expand Down Expand Up @@ -781,6 +782,7 @@ changes:
-->

* `size` {integer} The desired length of the new `Buffer`.
* Returns: {Buffer}

Allocates a new `Buffer` of `size` bytes. If `size` is larger than
[`buffer.constants.MAX_LENGTH`][] or smaller than 0, [`ERR_OUT_OF_RANGE`][]
Expand Down Expand Up @@ -851,6 +853,7 @@ changes:
-->

* `size` {integer} The desired length of the new `Buffer`.
* Returns: {Buffer}

Allocates a new `Buffer` of `size` bytes. If `size` is larger than
[`buffer.constants.MAX_LENGTH`][] or smaller than 0, [`ERR_OUT_OF_RANGE`][]
Expand Down Expand Up @@ -1097,6 +1100,7 @@ added:
* `offset` {integer} The starting offset within `view`. **Default:**: `0`.
* `length` {integer} The number of elements from `view` to copy.
**Default:** `view.length - offset`.
* Returns: {Buffer}

Copies the underlying memory of `view` into a new `Buffer`.

Expand All @@ -1116,6 +1120,7 @@ added: v5.10.0
-->

* `array` {integer\[]}
* Returns: {Buffer}

Allocates a new `Buffer` using an `array` of bytes in the range `0``255`.
Array entries outside that range will be truncated to fit into it.
Expand Down Expand Up @@ -1158,6 +1163,7 @@ added: v5.10.0
* `byteOffset` {integer} Index of first byte to expose. **Default:** `0`.
* `length` {integer} Number of bytes to expose.
**Default:** `arrayBuffer.byteLength - byteOffset`.
* Returns: {Buffer}

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 Expand Up @@ -1270,6 +1276,7 @@ added: v5.10.0

* `buffer` {Buffer|Uint8Array} An existing `Buffer` or [`Uint8Array`][] from
which to copy data.
* Returns: {Buffer}

Copies the passed `buffer` data onto a new `Buffer` instance.

Expand Down Expand Up @@ -1313,6 +1320,7 @@ added: v8.2.0
* `object` {Object} An object supporting `Symbol.toPrimitive` or `valueOf()`.
* `offsetOrEncoding` {integer|string} A byte-offset or encoding.
* `length` {integer} A length.
* Returns: {Buffer}

For objects whose `valueOf()` function returns a value not strictly equal to
`object`, returns `Buffer.from(object.valueOf(), offsetOrEncoding, length)`.
Expand Down Expand Up @@ -1371,6 +1379,7 @@ added: v5.10.0

* `string` {string} A string to encode.
* `encoding` {string} The encoding of `string`. **Default:** `'utf8'`.
* Returns: {Buffer}

Creates a new `Buffer` containing `string`. The `encoding` parameter identifies
the character encoding to be used when converting `string` into bytes.
Expand Down

0 comments on commit 23d89da

Please sign in to comment.