@ -612,7 +612,7 @@ added: v0.1.90
calculate the length of
* `encoding` {String} If `string` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Integer} The number of bytes contained within `string`
* Returns : {Integer} The number of bytes contained within `string`
Returns the actual byte length of a string. This is not the same as
[`String.prototype.length`] since that returns the number of *characters* in
@ -640,7 +640,7 @@ added: v0.11.13
* `buf1` {Buffer}
* `buf2` {Buffer}
* Return: {Integer}
* Returns : {Integer}
Compares `buf1` to `buf2` typically for the purpose of sorting arrays of
`Buffer` instances. This is equivalent to calling
@ -666,7 +666,7 @@ added: v0.7.11
* `list` {Array} List of `Buffer` instances to concat
* `totalLength` {Integer} Total length of the `Buffer` instances in `list`
when concatenated
* Return: {Buffer}
* Returns : {Buffer}
Returns a new `Buffer` which is the result of concatenating all the `Buffer`
instances in the `list` together.
@ -831,7 +831,7 @@ added: v0.1.101
-->
* `obj` {Object}
* Return: {Boolean}
* Returns : {Boolean}
Returns `true` if `obj` is a `Buffer` , `false` otherwise.
@ -841,7 +841,7 @@ added: v0.9.1
-->
* `encoding` {String} A character encoding name to check
* Return: {Boolean}
* Returns : {Boolean}
Returns `true` if `encoding` contains a supported character encoding, or `false`
otherwise.
@ -896,7 +896,7 @@ added: v0.11.13
* `sourceEnd` {Integer} The offset within `buf` at which to end comparison
(not inclusive). Ignored when `targetStart` is `undefined` .
**Default:** [`buf.length`]
* Return: {Integer}
* Returns : {Integer}
Compares `buf` with `target` and returns a number indicating whether `buf`
comes before, after, or is the same as `target` in sort order.
@ -968,7 +968,7 @@ added: v0.1.90
Ignored when `targetStart` is `undefined` . **Default:** `0`
* `sourceEnd` {Integer} The offset within `buf` at which to stop copying (not
inclusive). Ignored when `sourceStart` is `undefined` . **Default:** [`buf.length`]
* Return: {Integer} The number of bytes copied.
* Returns : {Integer} The number of bytes copied.
Copies data from a region of `buf` to a region in `target` even if the `target`
memory region overlaps with `buf` .
@ -1013,7 +1013,7 @@ console.log(buf.toString());
added: v1.1.0
-->
* Return: {Iterator}
* Returns : {Iterator}
Creates and returns an [iterator] of `[index, byte]` pairs from the contents of
`buf` .
@ -1041,7 +1041,7 @@ added: v0.11.13
-->
* `otherBuffer` {Buffer} A `Buffer` to compare to
* Return: {Boolean}
* Returns : {Boolean}
Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,
`false` otherwise.
@ -1070,7 +1070,7 @@ added: v0.5.0
* `end` {Integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`]
* `encoding` {String} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Buffer} A reference to `buf`
* Returns : {Buffer} A reference to `buf`
Fills `buf` with the specified `value` . If the `offset` and `end` are not given,
the entire `buf` will be filled. This is meant to be a small simplification to
@ -1106,7 +1106,7 @@ added: v1.5.0
* `byteOffset` {Integer} Where to begin searching in `buf` . **Default:** `0`
* `encoding` {String} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Integer} The index of the first occurrence of `value` in `buf` or `-1`
* Returns : {Integer} The index of the first occurrence of `value` in `buf` or `-1`
if `buf` does not contain `value`
If `value` is:
@ -1161,7 +1161,7 @@ added: v5.3.0
* `byteOffset` {Integer} Where to begin searching in `buf` . **Default:** `0`
* `encoding` {String} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Boolean} `true` if `value` was found in `buf` , `false` otherwise
* Returns : {Boolean} `true` if `value` was found in `buf` , `false` otherwise
Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`].
@ -1198,7 +1198,7 @@ console.log(buf.includes('this', 4));
added: v1.1.0
-->
* Return: {Iterator}
* Returns : {Iterator}
Creates and returns an [iterator] of `buf` keys (indices).
@ -1229,7 +1229,7 @@ added: v6.0.0
**Default:** [`buf.length`]
* `encoding` {String} If `value` is a string, this is its encoding.
**Default:** `'utf8'`
* Return: {Integer} The index of the last occurrence of `value` in `buf` or `-1`
* Returns : {Integer} The index of the last occurrence of `value` in `buf` or `-1`
if `buf` does not contain `value`
Identical to [`buf.indexOf()`], except `buf` is searched from back to front
@ -1325,7 +1325,7 @@ added: v0.11.15
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* Return: {Number}
* Returns : {Number}
Reads a 64-bit double from `buf` at the specified `offset` with specified
endian format (`readDoubleBE()` returns big endian, `readDoubleLE()` returns
@ -1361,7 +1361,7 @@ added: v0.11.15
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* Return: {Number}
* Returns : {Number}
Reads a 32-bit float from `buf` at the specified `offset` with specified
endian format (`readFloatBE()` returns big endian, `readFloatLE()` returns
@ -1396,7 +1396,7 @@ added: v0.5.0
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* Return: {Integer}
* Returns : {Integer}
Reads a signed 8-bit integer from `buf` at the specified `offset` .
@ -1428,7 +1428,7 @@ added: v0.5.5
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* Return: {Integer}
* Returns : {Integer}
Reads a signed 16-bit integer from `buf` at the specified `offset` with
the specified endian format (`readInt16BE()` returns big endian,
@ -1462,7 +1462,7 @@ added: v0.5.5
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* Return: {Integer}
* Returns : {Integer}
Reads a signed 32-bit integer from `buf` at the specified `offset` with
the specified endian format (`readInt32BE()` returns big endian,
@ -1497,7 +1497,7 @@ added: v0.11.15
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`
* `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
* Return: {Integer}
* Returns : {Integer}
Reads `byteLength` number of bytes from `buf` at the specified `offset`
and interprets the result as a two's complement signed value. Supports up to 48
@ -1528,7 +1528,7 @@ added: v0.5.0
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* Return: {Integer}
* Returns : {Integer}
Reads an unsigned 8-bit integer from `buf` at the specified `offset` .
@ -1558,7 +1558,7 @@ added: v0.5.5
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* Return: {Integer}
* Returns : {Integer}
Reads an unsigned 16-bit integer from `buf` at the specified `offset` with
specified endian format (`readUInt16BE()` returns big endian, `readUInt16LE()`
@ -1596,7 +1596,7 @@ added: v0.5.5
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `offset` validation? **Default:** `false`
* Return: {Integer}
* Returns : {Integer}
Reads an unsigned 32-bit integer from `buf` at the specified `offset` with
specified endian format (`readUInt32BE()` returns big endian,
@ -1629,7 +1629,7 @@ added: v0.11.15
* `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength`
* `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false`
* Return: {Integer}
* Returns : {Integer}
Reads `byteLength` number of bytes from `buf` at the specified `offset`
and interprets the result as an unsigned integer. Supports up to 48
@ -1661,7 +1661,7 @@ added: v0.3.0
* `start` {Integer} Where the new `Buffer` will start. **Default:** `0`
* `end` {Integer} Where the new `Buffer` will end (not inclusive).
**Default:** [`buf.length`]
* Return: {Buffer}
* Returns : {Buffer}
Returns a new `Buffer` that references the same memory as the original, but
offset and cropped by the `start` and `end` indices.
@ -1717,7 +1717,7 @@ console.log(buf.slice(-5, -2).toString());
added: v5.10.0
-->
* Return: {Buffer} A reference to `buf`
* Returns : {Buffer} A reference to `buf`
Interprets `buf` as an array of unsigned 16-bit integers and swaps the byte-order
*in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 2.
@ -1747,7 +1747,7 @@ buf2.swap32();
added: v5.10.0
-->
* Return: {Buffer} A reference to `buf`
* Returns : {Buffer} A reference to `buf`
Interprets `buf` as an array of unsigned 32-bit integers and swaps the byte-order
*in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 4.
@ -1777,7 +1777,7 @@ buf2.swap32();
added: v6.3.0
-->
* Return: {Buffer} A reference to `buf`
* Returns : {Buffer} A reference to `buf`
Interprets `buf` as an array of 64-bit numbers and swaps the byte-order *in-place* .
Throws a `RangeError` if [`buf.length`] is not a multiple of 8.
@ -1814,7 +1814,7 @@ added: v0.1.90
* `start` {Integer} The byte offset to start decoding at. **Default:** `0`
* `end` {Integer} The byte offset to stop decoding at (not inclusive).
**Default:** [`buf.length`]
* Return: {String}
* Returns : {String}
Decodes `buf` to a string according to the specified character encoding in
`encoding` . `start` and `end` may be passed to decode only a subset of `buf` .
@ -1853,7 +1853,7 @@ console.log(buf2.toString(undefined, 0, 3));
added: v0.9.2
-->
* Return: {Object}
* Returns : {Object}
Returns a JSON representation of `buf` . [`JSON.stringify()`] implicitly calls
this function when stringifying a `Buffer` instance.
@ -1882,7 +1882,7 @@ console.log(copy);
added: v1.1.0
-->
* Return: {Iterator}
* Returns : {Iterator}
Creates and returns an [iterator] for `buf` values (bytes). This function is
called automatically when a `Buffer` is used in a `for..of` statement.
@ -1924,7 +1924,7 @@ added: v0.1.90
* `offset` {Integer} Where to start writing `string` . **Default:** `0`
* `length` {Integer} How many bytes to write. **Default:** `buf.length - offset`
* `encoding` {String} The character encoding of `string` . **Default:** `'utf8'`
* Return: {Integer} Number of bytes written
* Returns : {Integer} Number of bytes written
Writes `string` to `buf` at `offset` according to the character encoding in `encoding` .
The `length` parameter is the number of bytes to write. If `buf` did not contain
@ -1951,7 +1951,7 @@ added: v0.11.15
* `value` {Number} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little
@ -1986,7 +1986,7 @@ added: v0.11.15
* `value` {Number} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little
@ -2020,7 +2020,7 @@ added: v0.5.0
* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` . `value` *should* be a valid
signed 8-bit integer. Behavior is undefined when `value` is anything other than
@ -2052,7 +2052,7 @@ added: v0.5.5
* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeInt16BE()` writes big endian, `writeInt16LE()` writes little
@ -2085,7 +2085,7 @@ added: v0.5.5
* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeInt32BE()` writes big endian, `writeInt32LE()` writes little
@ -2120,7 +2120,7 @@ added: v0.11.15
* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `value` , `offset` , and `byteLength` validation?
**Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `byteLength` bytes of `value` to `buf` at the specified `offset` .
Supports up to 48 bits of accuracy. Behavior is undefined when `value` is
@ -2153,7 +2153,7 @@ added: v0.5.0
* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` . `value` *should* be a
valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
@ -2185,7 +2185,7 @@ added: v0.5.5
* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little
@ -2222,7 +2222,7 @@ added: v0.5.5
* `value` {Integer} Number to be written to `buf`
* `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4`
* `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `value` to `buf` at the specified `offset` with specified endian
format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little
@ -2259,7 +2259,7 @@ added: v0.5.5
* `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6`
* `noAssert` {Boolean} Skip `value` , `offset` , and `byteLength` validation?
**Default:** `false`
* Return: {Integer} `offset` plus the number of bytes written
* Returns : {Integer} `offset` plus the number of bytes written
Writes `byteLength` bytes of `value` to `buf` at the specified `offset` .
Supports up to 48 bits of accuracy. Behavior is undefined when `value` is