docs: update docusaurus to v3 (#5625)

* update dependencies

* update onboarding mdx

* fixes for mdx issues

* fixes for mdx compatibility

* resolve mdx errors

* fixes in reference

* fix check errors

* revert change in vale action

* fix node version in action

* fix summary in markdown
This commit is contained in:
Shahed Nasser authored and GitHub committed 2023-11-13 20:11:50 +02:00
1 parent cedab58339
commit c6dff873de
2265 files changed
+46163 -47195

No files matched your search

@@ -8,16 +8,16 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).[iterator]
**[iterator]**(): [`IterableIterator`](../../interfaces/IterableIterator.mdx)<`number`\>
`**[iterator]**(): [IterableIterator](../../interfaces/IterableIterator.mdx)&#60;number&#62;`
#### Returns
[`IterableIterator`](../../interfaces/IterableIterator.mdx)<`number`\>
[IterableIterator](../../interfaces/IterableIterator.mdx)&#60;number&#62;
<ParameterTypes parameters={[
{
"name": "IterableIterator",
"type": "[`IterableIterator`](../../interfaces/IterableIterator.mdx)<`number`\\>",
"type": "[IterableIterator](../../interfaces/IterableIterator.mdx)&#60;number&#62;",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).at
**at**(`index`): `undefined` \| `number`
`**at**(index): undefined \| number`
Takes an integer value and returns the item at that index,
allowing for positive and negative integers.
@@ -8,14 +8,14 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).compare
**compare**(`target`, `targetStart?`, `targetEnd?`, `sourceStart?`, `sourceEnd?`): ``0`` \| ``1`` \| ``-1``
`**compare**(target, targetStart?, targetEnd?, sourceStart?, sourceEnd?): `0` \| `1` \| `-1``
Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order.
Comparison is based on the actual sequence of bytes in each `Buffer`.
* `0` is returned if `target` is the same as `buf`
* `1` is returned if `target` should come _before_`buf` when sorted.
* `-1` is returned if `target` should come _after_`buf` when sorted.
* `1` is returned if `target` should come \_before\_`buf` when sorted.
* `-1` is returned if `target` should come \_after\_`buf` when sorted.
```js
import { Buffer } from 'node:buffer';
@@ -62,7 +62,7 @@ console.log(buf1.compare(buf2, 5, 6, 5));
<ParameterTypes parameters={[
{
"name": "target",
"type": "`Uint8Array`",
"type": "Uint8Array",
"description": "A `Buffer` or Uint8Array with which to compare `buf`.",
"optional": false,
"defaultValue": "",
@@ -113,7 +113,7 @@ console.log(buf1.compare(buf2, 5, 6, 5));
<ParameterTypes parameters={[
{
"name": "``0`` \\| ``1`` \\| ``-1``",
"name": "`0` \\| `1` \\| `-1`",
"type": "``0`` \\| ``1`` \\| ``-1``",
"optional": true,
"defaultValue": "",
@@ -8,11 +8,11 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).copy
**copy**(`target`, `targetStart?`, `sourceStart?`, `sourceEnd?`): `number`
`**copy**(target, targetStart?, sourceStart?, sourceEnd?): number`
Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`.
[`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available
[`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/TypedArray/set) performs the same operation, and is available
for all TypedArrays, including Node.js `Buffer`s, although it takes
different function arguments.
@@ -61,7 +61,7 @@ console.log(buf.toString());
<ParameterTypes parameters={[
{
"name": "target",
"type": "`Uint8Array`",
"type": "Uint8Array",
"description": "A `Buffer` or Uint8Array to copy into.",
"optional": false,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).copyWithin
**copyWithin**(`target`, `start`, `end?`): [`Buffer`](../../variables/Buffer-1.mdx)
`**copyWithin**(target, start, end?): [Buffer](../../variables/Buffer-1.mdx)`
Returns the this object after copying a section of the array identified by start and end
to the same array starting at position target
@@ -47,12 +47,12 @@ to the same array starting at position target
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,9 +8,9 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).entries
**entries**(): [`IterableIterator`](../../interfaces/IterableIterator.mdx)<[`number`, `number`]\>
`**entries**(): [IterableIterator](../../interfaces/IterableIterator.mdx)&#60;[number, number]&#62;`
Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `[index, byte]` pairs from the contents
Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration\_protocols) of `[index, byte]` pairs from the contents
of `buf`.
```js
@@ -34,12 +34,12 @@ for (const pair of buf.entries()) {
#### Returns
[`IterableIterator`](../../interfaces/IterableIterator.mdx)<[`number`, `number`]\>
[IterableIterator](../../interfaces/IterableIterator.mdx)&#60;[number, number]&#62;
<ParameterTypes parameters={[
{
"name": "IterableIterator",
"type": "[`IterableIterator`](../../interfaces/IterableIterator.mdx)<[`number`, `number`]\\>",
"type": "[IterableIterator](../../interfaces/IterableIterator.mdx)&#60;[number, number]&#62;",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).equals
**equals**(`otherBuffer`): `boolean`
`**equals**(otherBuffer): boolean`
Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`.
@@ -30,7 +30,7 @@ console.log(buf1.equals(buf3));
<ParameterTypes parameters={[
{
"name": "otherBuffer",
"type": "`Uint8Array`",
"type": "Uint8Array",
"description": "A `Buffer` or Uint8Array with which to compare `buf`.",
"optional": false,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).every
**every**(`predicate`, `thisArg?`): `boolean`
`**every**(predicate, thisArg?): boolean`
Determines whether all the members of an array satisfy the specified test.
@@ -17,7 +17,7 @@ Determines whether all the members of an array satisfy the specified test.
<ParameterTypes parameters={[
{
"name": "predicate",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `unknown`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `unknown`",
"description": "A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.",
"optional": false,
"defaultValue": "",
@@ -25,7 +25,7 @@ Determines whether all the members of an array satisfy the specified test.
"children": [
{
"name": "__type",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `unknown`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `unknown`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).fill
**fill**(`value`, `offset?`, `end?`, `encoding?`): [`Buffer`](../../variables/Buffer-1.mdx)
`**fill**(value, offset?, end?, encoding?): [Buffer](../../variables/Buffer-1.mdx)`
Fills `buf` with the specified `value`. If the `offset` and `end` are not given,
the entire `buf` will be filled:
@@ -67,7 +67,7 @@ console.log(buf.fill('zz', 'hex'));
<ParameterTypes parameters={[
{
"name": "value",
"type": "`string` \\| `number` \\| `Uint8Array`",
"type": "`string` \\| `number` \\| Uint8Array",
"description": "The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`.",
"optional": false,
"defaultValue": "",
@@ -94,7 +94,7 @@ console.log(buf.fill('zz', 'hex'));
},
{
"name": "encoding",
"type": "[`BufferEncoding`](../../types/BufferEncoding.mdx)",
"type": "[BufferEncoding](../../types/BufferEncoding.mdx)",
"description": "The encoding for `value` if `value` is a string.",
"optional": true,
"defaultValue": "",
@@ -105,12 +105,12 @@ console.log(buf.fill('zz', 'hex'));
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "A reference to `buf`.",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).filter
**filter**(`predicate`, `thisArg?`): `Uint8Array`
`**filter**(predicate, thisArg?): Uint8Array`
Returns the elements of an array that meet the condition specified in a callback function.
@@ -17,7 +17,7 @@ Returns the elements of an array that meet the condition specified in a callback
<ParameterTypes parameters={[
{
"name": "predicate",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `any`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `any`",
"description": "A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.",
"optional": false,
"defaultValue": "",
@@ -25,7 +25,7 @@ Returns the elements of an array that meet the condition specified in a callback
"children": [
{
"name": "__type",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `any`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `any`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -47,12 +47,12 @@ Returns the elements of an array that meet the condition specified in a callback
#### Returns
`Uint8Array`
Uint8Array
<ParameterTypes parameters={[
{
"name": "Uint8Array",
"type": "`Uint8Array`",
"type": "Uint8Array",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).find
**find**(`predicate`, `thisArg?`): `undefined` \| `number`
`**find**(predicate, thisArg?): undefined \| number`
Returns the value of the first element in the array where predicate is true, and undefined
otherwise.
@@ -18,7 +18,7 @@ otherwise.
<ParameterTypes parameters={[
{
"name": "predicate",
"type": "(`value`: `number`, `index`: `number`, `obj`: `Uint8Array`) => `boolean`",
"type": "(`value`: `number`, `index`: `number`, `obj`: Uint8Array) => `boolean`",
"description": "find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.",
"optional": false,
"defaultValue": "",
@@ -26,7 +26,7 @@ otherwise.
"children": [
{
"name": "__type",
"type": "(`value`: `number`, `index`: `number`, `obj`: `Uint8Array`) => `boolean`",
"type": "(`value`: `number`, `index`: `number`, `obj`: Uint8Array) => `boolean`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).findIndex
**findIndex**(`predicate`, `thisArg?`): `number`
`**findIndex**(predicate, thisArg?): number`
Returns the index of the first element in the array where predicate is true, and -1
otherwise.
@@ -18,7 +18,7 @@ otherwise.
<ParameterTypes parameters={[
{
"name": "predicate",
"type": "(`value`: `number`, `index`: `number`, `obj`: `Uint8Array`) => `boolean`",
"type": "(`value`: `number`, `index`: `number`, `obj`: Uint8Array) => `boolean`",
"description": "find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.",
"optional": false,
"defaultValue": "",
@@ -26,7 +26,7 @@ otherwise.
"children": [
{
"name": "__type",
"type": "(`value`: `number`, `index`: `number`, `obj`: `Uint8Array`) => `boolean`",
"type": "(`value`: `number`, `index`: `number`, `obj`: Uint8Array) => `boolean`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).forEach
**forEach**(`callbackfn`, `thisArg?`): `void`
`**forEach**(callbackfn, thisArg?): void`
Performs the specified action for each element in an array.
@@ -17,7 +17,7 @@ Performs the specified action for each element in an array.
<ParameterTypes parameters={[
{
"name": "callbackfn",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `void`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `void`",
"description": "A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.",
"optional": false,
"defaultValue": "",
@@ -25,7 +25,7 @@ Performs the specified action for each element in an array.
"children": [
{
"name": "__type",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `void`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `void`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).includes
**includes**(`value`, `byteOffset?`, `encoding?`): `boolean`
`**includes**(value, byteOffset?, encoding?): boolean`
Equivalent to `buf.indexOf() !== -1`.
@@ -38,7 +38,7 @@ console.log(buf.includes('this', 4));
<ParameterTypes parameters={[
{
"name": "value",
"type": "`string` \\| `number` \\| [`Buffer`](../../variables/Buffer-1.mdx)",
"type": "`string` \\| `number` \\| [Buffer](../../variables/Buffer-1.mdx)",
"description": "What to search for.",
"optional": false,
"defaultValue": "",
@@ -56,7 +56,7 @@ console.log(buf.includes('this', 4));
},
{
"name": "encoding",
"type": "[`BufferEncoding`](../../types/BufferEncoding.mdx)",
"type": "[BufferEncoding](../../types/BufferEncoding.mdx)",
"description": "If `value` is a string, this is its encoding.",
"optional": true,
"defaultValue": "",
@@ -8,12 +8,12 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).indexOf
**indexOf**(`value`, `byteOffset?`, `encoding?`): `number`
`**indexOf**(value, byteOffset?, encoding?): number`
If `value` is:
* a string, `value` is interpreted according to the character encoding in`encoding`.
* a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
* a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Uint8Array), `value` will be used in its entirety.
To compare a partial `Buffer`, use `buf.subarray`.
* a number, `value` will be interpreted as an unsigned 8-bit integer
value between `0` and `255`.
@@ -49,7 +49,7 @@ an integer between 0 and 255.
If `byteOffset` is not a number, it will be coerced to a number. If the result
of coercion is `NaN` or `0`, then the entire buffer will be searched. This
behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf).
behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/String/indexOf).
```js
import { Buffer } from 'node:buffer';
@@ -77,7 +77,7 @@ than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOf
<ParameterTypes parameters={[
{
"name": "value",
"type": "`string` \\| `number` \\| `Uint8Array`",
"type": "`string` \\| `number` \\| Uint8Array",
"description": "What to search for.",
"optional": false,
"defaultValue": "",
@@ -95,7 +95,7 @@ than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOf
},
{
"name": "encoding",
"type": "[`BufferEncoding`](../../types/BufferEncoding.mdx)",
"type": "[BufferEncoding](../../types/BufferEncoding.mdx)",
"description": "If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`.",
"optional": true,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).join
**join**(`separator?`): `string`
`**join**(separator?): string`
Adds all the elements of an array separated by the specified separator string.
@@ -8,9 +8,9 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).keys
**keys**(): [`IterableIterator`](../../interfaces/IterableIterator.mdx)<`number`\>
`**keys**(): [IterableIterator](../../interfaces/IterableIterator.mdx)&#60;number&#62;`
Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `buf` keys (indices).
Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration\_protocols) of `buf` keys (indices).
```js
import { Buffer } from 'node:buffer';
@@ -31,12 +31,12 @@ for (const key of buf.keys()) {
#### Returns
[`IterableIterator`](../../interfaces/IterableIterator.mdx)<`number`\>
[IterableIterator](../../interfaces/IterableIterator.mdx)&#60;number&#62;
<ParameterTypes parameters={[
{
"name": "IterableIterator",
"type": "[`IterableIterator`](../../interfaces/IterableIterator.mdx)<`number`\\>",
"type": "[IterableIterator](../../interfaces/IterableIterator.mdx)&#60;number&#62;",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).lastIndexOf
**lastIndexOf**(`value`, `byteOffset?`, `encoding?`): `number`
`**lastIndexOf**(value, byteOffset?, encoding?): number`
Identical to `buf.indexOf()`, except the last occurrence of `value` is found
rather than the first occurrence.
@@ -46,7 +46,7 @@ an integer between 0 and 255.
If `byteOffset` is not a number, it will be coerced to a number. Any arguments
that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer.
This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf).
This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/String/lastIndexOf).
```js
import { Buffer } from 'node:buffer';
@@ -76,7 +76,7 @@ If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned.
<ParameterTypes parameters={[
{
"name": "value",
"type": "`string` \\| `number` \\| `Uint8Array`",
"type": "`string` \\| `number` \\| Uint8Array",
"description": "What to search for.",
"optional": false,
"defaultValue": "",
@@ -94,7 +94,7 @@ If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned.
},
{
"name": "encoding",
"type": "[`BufferEncoding`](../../types/BufferEncoding.mdx)",
"type": "[BufferEncoding](../../types/BufferEncoding.mdx)",
"description": "If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`.",
"optional": true,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).map
**map**(`callbackfn`, `thisArg?`): `Uint8Array`
`**map**(callbackfn, thisArg?): Uint8Array`
Calls a defined callback function on each element of an array, and returns an array that
contains the results.
@@ -18,7 +18,7 @@ contains the results.
<ParameterTypes parameters={[
{
"name": "callbackfn",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `number`",
"description": "A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.",
"optional": false,
"defaultValue": "",
@@ -26,7 +26,7 @@ contains the results.
"children": [
{
"name": "__type",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `number`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -48,12 +48,12 @@ contains the results.
#### Returns
`Uint8Array`
Uint8Array
<ParameterTypes parameters={[
{
"name": "Uint8Array",
"type": "`Uint8Array`",
"type": "Uint8Array",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readBigInt64BE
**readBigInt64BE**(`offset?`): `bigint`
`**readBigInt64BE**(offset?): bigint`
Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readBigInt64LE
**readBigInt64LE**(`offset?`): `bigint`
`**readBigInt64LE**(offset?): bigint`
Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readBigUInt64BE
**readBigUInt64BE**(`offset?`): `bigint`
`**readBigUInt64BE**(offset?): bigint`
Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readBigUInt64LE
**readBigUInt64LE**(`offset?`): `bigint`
`**readBigUInt64LE**(offset?): bigint`
Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readBigUint64BE
**readBigUint64BE**(`offset?`): `bigint`
`**readBigUint64BE**(offset?): bigint`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readBigUint64LE
**readBigUint64LE**(`offset?`): `bigint`
`**readBigUint64LE**(offset?): bigint`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readDoubleBE
**readDoubleBE**(`offset?`): `number`
`**readDoubleBE**(offset?): number`
Reads a 64-bit, big-endian double from `buf` at the specified `offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readDoubleLE
**readDoubleLE**(`offset?`): `number`
`**readDoubleLE**(offset?): number`
Reads a 64-bit, little-endian double from `buf` at the specified `offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readFloatBE
**readFloatBE**(`offset?`): `number`
`**readFloatBE**(offset?): number`
Reads a 32-bit, big-endian float from `buf` at the specified `offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readFloatLE
**readFloatLE**(`offset?`): `number`
`**readFloatLE**(offset?): number`
Reads a 32-bit, little-endian float from `buf` at the specified `offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readInt16BE
**readInt16BE**(`offset?`): `number`
`**readInt16BE**(offset?): number`
Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readInt16LE
**readInt16LE**(`offset?`): `number`
`**readInt16LE**(offset?): number`
Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readInt32BE
**readInt32BE**(`offset?`): `number`
`**readInt32BE**(offset?): number`
Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readInt32LE
**readInt32LE**(`offset?`): `number`
`**readInt32LE**(offset?): number`
Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readInt8
**readInt8**(`offset?`): `number`
`**readInt8**(offset?): number`
Reads a signed 8-bit integer from `buf` at the specified `offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readIntBE
**readIntBE**(`offset`, `byteLength`): `number`
`**readIntBE**(offset, byteLength): number`
Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a big-endian, two's complement signed value
supporting up to 48 bits of accuracy.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readIntLE
**readIntLE**(`offset`, `byteLength`): `number`
`**readIntLE**(offset, byteLength): number`
Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a little-endian, two's complement signed value
supporting up to 48 bits of accuracy.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUInt16BE
**readUInt16BE**(`offset?`): `number`
`**readUInt16BE**(offset?): number`
Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUInt16LE
**readUInt16LE**(`offset?`): `number`
`**readUInt16LE**(offset?): number`
Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUInt32BE
**readUInt32BE**(`offset?`): `number`
`**readUInt32BE**(offset?): number`
Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUInt32LE
**readUInt32LE**(`offset?`): `number`
`**readUInt32LE**(offset?): number`
Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUInt8
**readUInt8**(`offset?`): `number`
`**readUInt8**(offset?): number`
Reads an unsigned 8-bit integer from `buf` at the specified `offset`.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUIntBE
**readUIntBE**(`offset`, `byteLength`): `number`
`**readUIntBE**(offset, byteLength): number`
Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting
up to 48 bits of accuracy.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUIntLE
**readUIntLE**(`offset`, `byteLength`): `number`
`**readUIntLE**(offset, byteLength): number`
Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting
up to 48 bits of accuracy.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUint16BE
**readUint16BE**(`offset?`): `number`
`**readUint16BE**(offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUint16LE
**readUint16LE**(`offset?`): `number`
`**readUint16LE**(offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUint32BE
**readUint32BE**(`offset?`): `number`
`**readUint32BE**(offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUint32LE
**readUint32LE**(`offset?`): `number`
`**readUint32LE**(offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUint8
**readUint8**(`offset?`): `number`
`**readUint8**(offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUintBE
**readUintBE**(`offset`, `byteLength`): `number`
`**readUintBE**(offset, byteLength): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).readUintLE
**readUintLE**(`offset`, `byteLength`): `number`
`**readUintLE**(offset, byteLength): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).reduce
**reduce**(`callbackfn`): `number`
`**reduce**(callbackfn): number`
Calls the specified callback function for all the elements in an array. The return value of
the callback function is the accumulated result, and is provided as an argument in the next
@@ -19,7 +19,7 @@ call to the callback function.
<ParameterTypes parameters={[
{
"name": "callbackfn",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `number`",
"description": "A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.",
"optional": false,
"defaultValue": "",
@@ -27,7 +27,7 @@ call to the callback function.
"children": [
{
"name": "__type",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `number`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -58,14 +58,14 @@ call to the callback function.
Uint8Array.reduce
**reduce**(`callbackfn`, `initialValue`): `number`
`**reduce**(callbackfn, initialValue): number`
#### Parameters
<ParameterTypes parameters={[
{
"name": "callbackfn",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `number`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -73,7 +73,7 @@ Uint8Array.reduce
"children": [
{
"name": "__type",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `number`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -113,7 +113,7 @@ Uint8Array.reduce
Uint8Array.reduce
**reduce**<`U`\>(`callbackfn`, `initialValue`): `U`
`**reduce**<TypeParameter U>(callbackfn, initialValue): U`
Calls the specified callback function for all the elements in an array. The return value of
the callback function is the accumulated result, and is provided as an argument in the next
@@ -136,7 +136,7 @@ call to the callback function.
<ParameterTypes parameters={[
{
"name": "callbackfn",
"type": "(`previousValue`: `U`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `U`",
"type": "(`previousValue`: `U`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `U`",
"description": "A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.",
"optional": false,
"defaultValue": "",
@@ -144,7 +144,7 @@ call to the callback function.
"children": [
{
"name": "__type",
"type": "(`previousValue`: `U`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `U`",
"type": "(`previousValue`: `U`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `U`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).reduceRight
**reduceRight**(`callbackfn`): `number`
`**reduceRight**(callbackfn): number`
Calls the specified callback function for all the elements in an array, in descending order.
The return value of the callback function is the accumulated result, and is provided as an
@@ -19,7 +19,7 @@ argument in the next call to the callback function.
<ParameterTypes parameters={[
{
"name": "callbackfn",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `number`",
"description": "A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.",
"optional": false,
"defaultValue": "",
@@ -27,7 +27,7 @@ argument in the next call to the callback function.
"children": [
{
"name": "__type",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `number`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -58,14 +58,14 @@ argument in the next call to the callback function.
Uint8Array.reduceRight
**reduceRight**(`callbackfn`, `initialValue`): `number`
`**reduceRight**(callbackfn, initialValue): number`
#### Parameters
<ParameterTypes parameters={[
{
"name": "callbackfn",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `number`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -73,7 +73,7 @@ Uint8Array.reduceRight
"children": [
{
"name": "__type",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `number`",
"type": "(`previousValue`: `number`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `number`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -113,7 +113,7 @@ Uint8Array.reduceRight
Uint8Array.reduceRight
**reduceRight**<`U`\>(`callbackfn`, `initialValue`): `U`
`**reduceRight**<TypeParameter U>(callbackfn, initialValue): U`
Calls the specified callback function for all the elements in an array, in descending order.
The return value of the callback function is the accumulated result, and is provided as an
@@ -136,7 +136,7 @@ argument in the next call to the callback function.
<ParameterTypes parameters={[
{
"name": "callbackfn",
"type": "(`previousValue`: `U`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `U`",
"type": "(`previousValue`: `U`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `U`",
"description": "A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.",
"optional": false,
"defaultValue": "",
@@ -144,7 +144,7 @@ argument in the next call to the callback function.
"children": [
{
"name": "__type",
"type": "(`previousValue`: `U`, `currentValue`: `number`, `currentIndex`: `number`, `array`: `Uint8Array`) => `U`",
"type": "(`previousValue`: `U`, `currentValue`: `number`, `currentIndex`: `number`, `array`: Uint8Array) => `U`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -8,16 +8,16 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).reverse
**reverse**(): [`Buffer`](../../variables/Buffer-1.mdx)
`**reverse**(): [Buffer](../../variables/Buffer-1.mdx)`
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).set
**set**(`array`, `offset?`): `void`
`**set**(array, offset?): void`
Sets a value or an array of values.
@@ -17,7 +17,7 @@ Sets a value or an array of values.
<ParameterTypes parameters={[
{
"name": "array",
"type": "[`ArrayLike`](../../interfaces/ArrayLike.mdx)<`number`\\>",
"type": "[ArrayLike](../../interfaces/ArrayLike.mdx)&#60;number&#62;",
"description": "A typed or untyped array of values to set.",
"optional": false,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).slice
**slice**(`start?`, `end?`): [`Buffer`](../../variables/Buffer-1.mdx)
`**slice**(start?, end?): [Buffer](../../variables/Buffer-1.mdx)`
Returns a new `Buffer` that references the same memory as the original, but
offset and cropped by the `start` and `end` indices.
@@ -63,12 +63,12 @@ console.log(buf.toString());
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).some
**some**(`predicate`, `thisArg?`): `boolean`
`**some**(predicate, thisArg?): boolean`
Determines whether the specified callback function returns true for any element of an array.
@@ -17,7 +17,7 @@ Determines whether the specified callback function returns true for any element
<ParameterTypes parameters={[
{
"name": "predicate",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `unknown`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `unknown`",
"description": "A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.",
"optional": false,
"defaultValue": "",
@@ -25,7 +25,7 @@ Determines whether the specified callback function returns true for any element
"children": [
{
"name": "__type",
"type": "(`value`: `number`, `index`: `number`, `array`: `Uint8Array`) => `unknown`",
"type": "(`value`: `number`, `index`: `number`, `array`: Uint8Array) => `unknown`",
"description": "",
"optional": false,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).sort
**sort**(`compareFn?`): [`Buffer`](../../variables/Buffer-1.mdx)
`**sort**(compareFn?): [Buffer](../../variables/Buffer-1.mdx)`
Sorts an array.
@@ -38,12 +38,12 @@ Sorts an array.
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).subarray
**subarray**(`start?`, `end?`): [`Buffer`](../../variables/Buffer-1.mdx)
`**subarray**(start?, end?): [Buffer](../../variables/Buffer-1.mdx)`
Returns a new `Buffer` that references the same memory as the original, but
offset and cropped by the `start` and `end` indices.
@@ -16,7 +16,7 @@ offset and cropped by the `start` and `end` indices.
Specifying `end` greater than `buf.length` will return the same result as
that of `end` equal to `buf.length`.
This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray).
This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/TypedArray/subarray).
Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
@@ -90,12 +90,12 @@ console.log(buf.subarray(-5, -2).toString());
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,10 +8,10 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).swap16
**swap16**(): [`Buffer`](../../variables/Buffer-1.mdx)
`**swap16**(): [Buffer](../../variables/Buffer-1.mdx)`
Interprets `buf` as an array of unsigned 16-bit integers and swaps the
byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2.
byte order \_in-place\_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2.
```js
import { Buffer } from 'node:buffer';
@@ -44,12 +44,12 @@ buf.swap16(); // Convert to big-endian UTF-16 text.
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "A reference to `buf`.",
@@ -8,10 +8,10 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).swap32
**swap32**(): [`Buffer`](../../variables/Buffer-1.mdx)
`**swap32**(): [Buffer](../../variables/Buffer-1.mdx)`
Interprets `buf` as an array of unsigned 32-bit integers and swaps the
byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
byte order \_in-place\_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
```js
import { Buffer } from 'node:buffer';
@@ -34,12 +34,12 @@ buf2.swap32();
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "A reference to `buf`.",
@@ -8,9 +8,9 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).swap64
**swap64**(): [`Buffer`](../../variables/Buffer-1.mdx)
`**swap64**(): [Buffer](../../variables/Buffer-1.mdx)`
Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_.
Interprets `buf` as an array of 64-bit numbers and swaps byte order \_in-place\_.
Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
```js
@@ -34,12 +34,12 @@ buf2.swap64();
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "A reference to `buf`.",
@@ -8,9 +8,9 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).toJSON
**toJSON**(): { `data`: `number`[] ; `type`: ``"Buffer"`` }
`**toJSON**(): &#123; data: number[] ; type: `"Buffer"` &#125;`
Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls
Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/JSON/stringify) implicitly calls
this function when stringifying a `Buffer` instance.
`Buffer.from()` accepts objects in the format returned from this method.
@@ -41,7 +41,7 @@ console.log(copy);
<ParameterTypes parameters={[
{
"name": "`object`",
"name": "object",
"type": "`object`",
"optional": true,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).toLocaleString
**toLocaleString**(): `string`
`**toLocaleString**(): string`
Converts a number to a string by using the current locale.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).toString
**toString**(`encoding?`, `start?`, `end?`): `string`
`**toString**(encoding?, start?, end?): 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`.
@@ -48,7 +48,7 @@ console.log(buf2.toString(undefined, 0, 3));
<ParameterTypes parameters={[
{
"name": "encoding",
"type": "[`BufferEncoding`](../../types/BufferEncoding.mdx)",
"type": "[BufferEncoding](../../types/BufferEncoding.mdx)",
"description": "The character encoding to use.",
"optional": true,
"defaultValue": "",
@@ -8,18 +8,18 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).valueOf
**valueOf**(): `Uint8Array`
`**valueOf**(): Uint8Array`
Returns the primitive value of the specified object.
#### Returns
`Uint8Array`
Uint8Array
<ParameterTypes parameters={[
{
"name": "Uint8Array",
"type": "`Uint8Array`",
"type": "Uint8Array",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,9 +8,9 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).values
**values**(): [`IterableIterator`](../../interfaces/IterableIterator.mdx)<`number`\>
`**values**(): [IterableIterator](../../interfaces/IterableIterator.mdx)&#60;number&#62;`
Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) for `buf` values (bytes). This function is
Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration\_protocols) for `buf` values (bytes). This function is
called automatically when a `Buffer` is used in a `for..of` statement.
```js
@@ -43,12 +43,12 @@ for (const value of buf) {
#### Returns
[`IterableIterator`](../../interfaces/IterableIterator.mdx)<`number`\>
[IterableIterator](../../interfaces/IterableIterator.mdx)&#60;number&#62;
<ParameterTypes parameters={[
{
"name": "IterableIterator",
"type": "[`IterableIterator`](../../interfaces/IterableIterator.mdx)<`number`\\>",
"type": "[IterableIterator](../../interfaces/IterableIterator.mdx)&#60;number&#62;",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).write
**write**(`string`, `encoding?`): `number`
`**write**(string, encoding?): number`
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 enough space to fit the entire string, only part of `string` will be
@@ -46,7 +46,7 @@ console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);
},
{
"name": "encoding",
"type": "[`BufferEncoding`](../../types/BufferEncoding.mdx)",
"type": "[BufferEncoding](../../types/BufferEncoding.mdx)",
"description": "The character encoding of `string`.",
"optional": true,
"defaultValue": "",
@@ -75,7 +75,7 @@ console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`);
v0.1.90
**write**(`string`, `offset`, `encoding?`): `number`
`**write**(string, offset, encoding?): number`
#### Parameters
@@ -100,7 +100,7 @@ v0.1.90
},
{
"name": "encoding",
"type": "[`BufferEncoding`](../../types/BufferEncoding.mdx)",
"type": "[BufferEncoding](../../types/BufferEncoding.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
@@ -125,7 +125,7 @@ v0.1.90
}
]} />
**write**(`string`, `offset`, `length`, `encoding?`): `number`
`**write**(string, offset, length, encoding?): number`
#### Parameters
@@ -159,7 +159,7 @@ v0.1.90
},
{
"name": "encoding",
"type": "[`BufferEncoding`](../../types/BufferEncoding.mdx)",
"type": "[BufferEncoding](../../types/BufferEncoding.mdx)",
"description": "",
"optional": true,
"defaultValue": "",
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeBigInt64BE
**writeBigInt64BE**(`value`, `offset?`): `number`
`**writeBigInt64BE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as big-endian.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeBigInt64LE
**writeBigInt64LE**(`value`, `offset?`): `number`
`**writeBigInt64LE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as little-endian.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeBigUInt64BE
**writeBigUInt64BE**(`value`, `offset?`): `number`
`**writeBigUInt64BE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as big-endian.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeBigUInt64LE
**writeBigUInt64LE**(`value`, `offset?`): `number`
`**writeBigUInt64LE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as little-endian
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeBigUint64BE
**writeBigUint64BE**(`value`, `offset?`): `number`
`**writeBigUint64BE**(value, offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeBigUint64LE
**writeBigUint64LE**(`value`, `offset?`): `number`
`**writeBigUint64LE**(value, offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeDoubleBE
**writeDoubleBE**(`value`, `offset?`): `number`
`**writeDoubleBE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything
other than a JavaScript number.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeDoubleLE
**writeDoubleLE**(`value`, `offset?`): `number`
`**writeDoubleLE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything
other than a JavaScript number.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeFloatBE
**writeFloatBE**(`value`, `offset?`): `number`
`**writeFloatBE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is
undefined when `value` is anything other than a JavaScript number.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeFloatLE
**writeFloatLE**(`value`, `offset?`): `number`
`**writeFloatLE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is
undefined when `value` is anything other than a JavaScript number.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeInt16BE
**writeInt16BE**(`value`, `offset?`): `number`
`**writeInt16BE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is
anything other than a signed 16-bit integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeInt16LE
**writeInt16LE**(`value`, `offset?`): `number`
`**writeInt16LE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is
anything other than a signed 16-bit integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeInt32BE
**writeInt32BE**(`value`, `offset?`): `number`
`**writeInt32BE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is
anything other than a signed 32-bit integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeInt32LE
**writeInt32LE**(`value`, `offset?`): `number`
`**writeInt32LE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is
anything other than a signed 32-bit integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeInt8
**writeInt8**(`value`, `offset?`): `number`
`**writeInt8**(value, offset?): number`
Writes `value` to `buf` at the specified `offset`. `value` must be a valid
signed 8-bit integer. Behavior is undefined when `value` is anything other than
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeIntBE
**writeIntBE**(`value`, `offset`, `byteLength`): `number`
`**writeIntBE**(value, offset, byteLength): number`
Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when`value` is anything other than a
signed integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeIntLE
**writeIntLE**(`value`, `offset`, `byteLength`): `number`
`**writeIntLE**(value, offset, byteLength): number`
Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined
when `value` is anything other than a signed integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUInt16BE
**writeUInt16BE**(`value`, `offset?`): `number`
`**writeUInt16BE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an
unsigned 16-bit integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUInt16LE
**writeUInt16LE**(`value`, `offset?`): `number`
`**writeUInt16LE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is
anything other than an unsigned 16-bit integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUInt32BE
**writeUInt32BE**(`value`, `offset?`): `number`
`**writeUInt32BE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an
unsigned 32-bit integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUInt32LE
**writeUInt32LE**(`value`, `offset?`): `number`
`**writeUInt32LE**(value, offset?): number`
Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is
anything other than an unsigned 32-bit integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUInt8
**writeUInt8**(`value`, `offset?`): `number`
`**writeUInt8**(value, offset?): number`
Writes `value` to `buf` at the specified `offset`. `value` must be a
valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUIntBE
**writeUIntBE**(`value`, `offset`, `byteLength`): `number`
`**writeUIntBE**(value, offset, byteLength): number`
Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined
when `value` is anything other than an unsigned integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUIntLE
**writeUIntLE**(`value`, `offset`, `byteLength`): `number`
`**writeUIntLE**(value, offset, byteLength): number`
Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined
when `value` is anything other than an unsigned integer.
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUint16BE
**writeUint16BE**(`value`, `offset?`): `number`
`**writeUint16BE**(value, offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUint16LE
**writeUint16LE**(`value`, `offset?`): `number`
`**writeUint16LE**(value, offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUint32BE
**writeUint32BE**(`value`, `offset?`): `number`
`**writeUint32BE**(value, offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUint32LE
**writeUint32LE**(`value`, `offset?`): `number`
`**writeUint32LE**(value, offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUint8
**writeUint8**(`value`, `offset?`): `number`
`**writeUint8**(value, offset?): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUintBE
**writeUintBE**(`value`, `offset`, `byteLength`): `number`
`**writeUintBE**(value, offset, byteLength): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[Buffer](../../interfaces/Buffer.mdx).writeUintLE
**writeUintLE**(`value`, `offset`, `byteLength`): `number`
`**writeUintLE**(value, offset, byteLength): number`
#### Parameters
@@ -8,7 +8,7 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[BufferConstructor](../../interfaces/BufferConstructor.mdx).alloc
**alloc**(`size`, `fill?`, `encoding?`): [`Buffer`](../../variables/Buffer-1.mdx)
`**alloc**(size, fill?, encoding?): [Buffer](../../variables/Buffer-1.mdx)`
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
@@ -66,7 +66,7 @@ A `TypeError` will be thrown if `size` is not a number.
},
{
"name": "fill",
"type": "`string` \\| `number` \\| `Uint8Array`",
"type": "`string` \\| `number` \\| Uint8Array",
"description": "A value to pre-fill the new `Buffer` with.",
"optional": true,
"defaultValue": "",
@@ -75,7 +75,7 @@ A `TypeError` will be thrown if `size` is not a number.
},
{
"name": "encoding",
"type": "[`BufferEncoding`](../../types/BufferEncoding.mdx)",
"type": "[BufferEncoding](../../types/BufferEncoding.mdx)",
"description": "If `fill` is a string, this is its encoding.",
"optional": true,
"defaultValue": "",
@@ -86,12 +86,12 @@ A `TypeError` will be thrown if `size` is not a number.
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "",
@@ -8,12 +8,12 @@ import ParameterTypes from "@site/src/components/ParameterTypes"
[BufferConstructor](../../interfaces/BufferConstructor.mdx).allocUnsafe
**allocUnsafe**(`size`): [`Buffer`](../../variables/Buffer-1.mdx)
`**allocUnsafe**(size): [Buffer](../../variables/Buffer-1.mdx)`
Allocates a new `Buffer` of `size` bytes. If `size` is larger than constants.MAX_LENGTH or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
The underlying memory for `Buffer` instances created in this way is _not_
_initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
The underlying memory for `Buffer` instances created in this way is \_not\_
\_initialized\_. The contents of the newly created `Buffer` are unknown and \_may contain sensitive data\_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
```js
import { Buffer } from 'node:buffer';
@@ -37,7 +37,7 @@ and `Buffer.concat()` only when `size` is less than or equal to`Buffer.poolSize
Use of this pre-allocated internal memory pool is a key difference between
calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less
Specifically, `Buffer.alloc(size, fill)` will \_never\_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`\_will\_ use the internal`Buffer` pool if `size` is less
than or equal to half `Buffer.poolSize`. The
difference is subtle but can be important when an application requires the
additional performance that `Buffer.allocUnsafe()` provides.
@@ -58,12 +58,12 @@ additional performance that `Buffer.allocUnsafe()` provides.
#### Returns
[`Buffer`](../../variables/Buffer-1.mdx)
[Buffer](../../variables/Buffer-1.mdx)
<ParameterTypes parameters={[
{
"name": "Buffer",
"type": "[`Buffer`](../../variables/Buffer-1.mdx)",
"type": "[Buffer](../../variables/Buffer-1.mdx)",
"optional": false,
"defaultValue": "",
"description": "",
Loaded 100 of 2265 files, more files were not shown because too many files have changed in this diff. Show more