From f5c4508caad3f8a58715c3eb19aff624ae35a2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 5 Jan 2021 09:06:24 +0100 Subject: [PATCH] doc: clearly document buffer's "Uint" aliases Fixes: https://github.com/nodejs/node/issues/36751 --- doc/api/buffer.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index e7f71079dc6798..d10a6a29267a18 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -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]); @@ -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]); @@ -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]); @@ -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]); @@ -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]); @@ -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]); @@ -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]); @@ -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]); @@ -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]); @@ -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); @@ -2407,6 +2427,8 @@ console.log(buf); // Prints: ``` +This function is also available under the `writeBigUint64LE` alias. + ### `buf.writeDoubleBE(value[, offset])`