Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: clearly document buffer's "Uint" aliases #36796

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions doc/api/buffer.md
Expand Up @@ -1416,6 +1416,8 @@ changes:
Reads an unsigned, big-endian 64-bit integer from `buf` at the specified
`offset`.

This function is also available under the `readBigUint64BE` alias.

```js
const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);

Expand Down Expand Up @@ -1443,6 +1445,8 @@ changes:
Reads an unsigned, little-endian 64-bit integer from `buf` at the specified
`offset`.

This function is also available under the `readBigUint64LE` alias.

```js
const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);

Expand Down Expand Up @@ -1760,6 +1764,8 @@ changes:

Reads an unsigned 8-bit integer from `buf` at the specified `offset`.

This function is also available under the `readUint8` alias.

```js
const buf = Buffer.from([1, -2]);

Expand Down Expand Up @@ -1793,6 +1799,8 @@ changes:
Reads an unsigned, big-endian 16-bit integer from `buf` at the specified
`offset`.

This function is also available under the `readUint16BE` alias.

```js
const buf = Buffer.from([0x12, 0x34, 0x56]);

Expand Down Expand Up @@ -1824,6 +1832,8 @@ changes:
Reads an unsigned, little-endian 16-bit integer from `buf` at the specified
`offset`.

This function is also available under the `readUint16LE` alias.

```js
const buf = Buffer.from([0x12, 0x34, 0x56]);

Expand Down Expand Up @@ -1857,6 +1867,8 @@ changes:
Reads an unsigned, big-endian 32-bit integer from `buf` at the specified
`offset`.

This function is also available under the `readUint32BE` alias.

```js
const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);

Expand Down Expand Up @@ -1886,6 +1898,8 @@ changes:
Reads an unsigned, little-endian 32-bit integer from `buf` at the specified
`offset`.

This function is also available under the `readUint32LE` alias.

```js
const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);

Expand Down Expand Up @@ -1920,6 +1934,8 @@ 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.

This function is also available under the `readUintBE` alias.

```js
const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);

Expand Down Expand Up @@ -1954,6 +1970,8 @@ 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.

This function is also available under the `readUintLE` alias.

```js
const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);

Expand Down Expand Up @@ -2369,6 +2387,8 @@ changes:

Writes `value` to `buf` at the specified `offset` as big-endian.

This function is also available under the `writeBigUint64BE` alias.

```js
const buf = Buffer.allocUnsafe(8);

Expand Down Expand Up @@ -2407,6 +2427,8 @@ console.log(buf);
// Prints: <Buffer de fa ce ca fe fa ca de>
```

This function is also available under the `writeBigUint64LE` alias.

### `buf.writeDoubleBE(value[, offset])`
<!-- YAML
added: v0.11.15
Expand Down Expand Up @@ -2754,6 +2776,8 @@ Writes `value` to `buf` at the specified `offset`. `value` must be a
valid unsigned 8-bit integer. Behavior is undefined when `value` is anything
other than an unsigned 8-bit integer.

This function is also available under the `writeUint8` alias.

```js
const buf = Buffer.allocUnsafe(4);

Expand Down Expand Up @@ -2790,6 +2814,8 @@ 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.

This function is also available under the `writeUint16BE` alias.

```js
const buf = Buffer.allocUnsafe(4);

Expand Down Expand Up @@ -2824,6 +2850,8 @@ 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.

This function is also available under the `writeUint16LE` alias.

```js
const buf = Buffer.allocUnsafe(4);

Expand Down Expand Up @@ -2858,6 +2886,8 @@ 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.

This function is also available under the `writeUint32BE` alias.

```js
const buf = Buffer.allocUnsafe(4);

Expand Down Expand Up @@ -2891,6 +2921,8 @@ 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.

This function is also available under the `writeUint32LE` alias.

```js
const buf = Buffer.allocUnsafe(4);

Expand Down Expand Up @@ -2926,6 +2958,8 @@ 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.

This function is also available under the `writeUintBE` alias.

```js
const buf = Buffer.allocUnsafe(6);

Expand Down Expand Up @@ -2961,6 +2995,8 @@ 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.

This function is also available under the `writeUintLE` alias.

```js
const buf = Buffer.allocUnsafe(6);

Expand Down