diff --git a/doc/api/buffer.md b/doc/api/buffer.md
index 27201823f57db9..156db8a8dfdca5 100644
--- a/doc/api/buffer.md
+++ b/doc/api/buffer.md
@@ -833,7 +833,7 @@ _may contain sensitive data_. Use [`buf.fill(0)`][`buf.fill()`] to initialize
such `Buffer` instances with zeroes.
When using [`Buffer.allocUnsafe()`][] to allocate new `Buffer` instances,
-allocations under 4 KB are sliced from a single pre-allocated `Buffer`. This
+allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
allows applications to avoid the garbage collection overhead of creating many
individually allocated `Buffer` instances. This approach improves both
performance and memory usage by eliminating the need to track and clean up as
@@ -5204,9 +5204,9 @@ changes:
* {integer} The largest size allowed for a single `Buffer` instance.
On 32-bit architectures, this value currently is 230 - 1 (about 1
-GB).
+GiB).
-On 64-bit architectures, this value currently is 232 (about 4 GB).
+On 64-bit architectures, this value currently is 232 (about 4 GiB).
It reflects [`v8::TypedArray::kMaxLength`][] under the hood.
diff --git a/doc/api/cli.md b/doc/api/cli.md
index 047ed24697a10d..74d300e368a010 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -666,10 +666,10 @@ added:
changes:
- version: v13.13.0
pr-url: https://github.com/nodejs/node/pull/32520
- description: Change maximum default size of HTTP headers from 8 KB to 16 KB.
+ description: Change maximum default size of HTTP headers from 8 KiB to 16 KiB.
-->
-Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KB.
+Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KiB.
### `--napi-modules`
@@ -1993,8 +1993,8 @@ Sets the max memory size of V8's old memory section. As memory
consumption approaches the limit, V8 will spend more time on
garbage collection in an effort to free unused memory.
-On a machine with 2 GB of memory, consider setting this to
-1536 (1.5 GB) to leave some memory for other uses and avoid swapping.
+On a machine with 2 GiB of memory, consider setting this to
+1536 (1.5 GiB) to leave some memory for other uses and avoid swapping.
```console
$ node --max-old-space-size=1536 index.js
diff --git a/doc/api/errors.md b/doc/api/errors.md
index 71cae6300b26ed..94afa6116086cb 100644
--- a/doc/api/errors.md
+++ b/doc/api/errors.md
@@ -2951,11 +2951,11 @@ changes:
- v10.15.0
commit: 186035243fad247e3955f
pr-url: https://github.com/nodejs-private/node-private/pull/143
- description: Max header size in `http_parser` was set to 8 KB.
+ description: Max header size in `http_parser` was set to 8 KiB.
-->
Too much HTTP header data was received. In order to protect against malicious or
-malconfigured clients, if more than 8 KB of HTTP header data is received then
+malconfigured clients, if more than 8 KiB of HTTP header data is received then
HTTP parsing will abort without a request or response object being created, and
an `Error` with this code will be emitted.
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 8050cd97b8cd84..d584d1f20a019e 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -262,8 +262,8 @@ added: v16.11.0
* `highWaterMark` {integer} **Default:** `64 * 1024`
* Returns: {fs.ReadStream}
-Unlike the 16 kb default `highWaterMark` for a {stream.Readable}, the stream
-returned by this method has a default `highWaterMark` of 64 kb.
+Unlike the 16 KiB default `highWaterMark` for a {stream.Readable}, the stream
+returned by this method has a default `highWaterMark` of 64 KiB.
`options` can include `start` and `end` values to read a range of bytes from
the file instead of the entire file. Both `start` and `end` are inclusive and
@@ -2186,8 +2186,8 @@ changes:
* `fs` {Object|null} **Default:** `null`
* Returns: {fs.ReadStream}
-Unlike the 16 kb default `highWaterMark` for a {stream.Readable}, the stream
-returned by this method has a default `highWaterMark` of 64 kb.
+Unlike the 16 KiB default `highWaterMark` for a {stream.Readable}, the stream
+returned by this method has a default `highWaterMark` of 64 KiB.
`options` can include `start` and `end` values to read a range of bytes from
the file instead of the entire file. Both `start` and `end` are inclusive and
@@ -3430,8 +3430,8 @@ to read a complete file into memory.
The additional read overhead can vary broadly on different systems and depends
on the type of file being read. If the file type is not a regular file (a pipe
for instance) and Node.js is unable to determine an actual file size, each read
-operation will load on 64 KB of data. For regular files, each read will process
-512 KB of data.
+operation will load on 64 KiB of data. For regular files, each read will process
+512 KiB of data.
For applications that require as-fast-as-possible reading of file contents, it
is better to use `fs.read()` directly and for application code to manage
diff --git a/doc/api/http.md b/doc/api/http.md
index 81c8f90a1c8bbb..c98eac6e024672 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -2998,7 +2998,7 @@ changes:
* `maxHeaderSize` {number} Optionally overrides the value of
[`--max-http-header-size`][] for requests received by this server, i.e.
the maximum length of request headers in bytes.
- **Default:** 16384 (16 KB).
+ **Default:** 16384 (16 KiB).
* `noDelay` {boolean} If set to `true`, it disables the use of Nagle's
algorithm immediately after a new incoming connection is received.
**Default:** `true`.
@@ -3154,7 +3154,7 @@ added:
* {number}
Read-only property specifying the maximum allowed size of HTTP headers in bytes.
-Defaults to 16 KB. Configurable using the [`--max-http-header-size`][] CLI
+Defaults to 16 KiB. Configurable using the [`--max-http-header-size`][] CLI
option.
This can be overridden for servers and client requests by passing the
@@ -3231,7 +3231,7 @@ changes:
* `maxHeaderSize` {number} Optionally overrides the value of
[`--max-http-header-size`][] (the maximum length of response headers in
bytes) for responses received from the server.
- **Default:** 16384 (16 KB).
+ **Default:** 16384 (16 KiB).
* `method` {string} A string specifying the HTTP request method. **Default:**
`'GET'`.
* `path` {string} Request path. Should include query string if any.
diff --git a/doc/api/stream.md b/doc/api/stream.md
index a3bca6da604352..9ba920f7795318 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -1674,7 +1674,7 @@ If the loop terminates with a `break`, `return`, or a `throw`, the stream will
be destroyed. In other terms, iterating over a stream will consume the stream
fully. The stream will be read in chunks of size equal to the `highWaterMark`
option. In the code example above, data will be in a single chunk if the file
-has less then 64 KB of data because no `highWaterMark` option is provided to
+has less then 64 KiB of data because no `highWaterMark` option is provided to
[`fs.createReadStream()`][].
##### `readable.iterator([options])`
@@ -3047,7 +3047,7 @@ changes:
* `options` {Object}
* `highWaterMark` {number} Buffer level when
[`stream.write()`][stream-write] starts returning `false`. **Default:**
- `16384` (16 KB), or `16` for `objectMode` streams.
+ `16384` (16 KiB), or `16` for `objectMode` streams.
* `decodeStrings` {boolean} Whether to encode `string`s passed to
[`stream.write()`][stream-write] to `Buffer`s (with the encoding
specified in the [`stream.write()`][stream-write] call) before passing
@@ -3420,7 +3420,7 @@ changes:
* `options` {Object}
* `highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store
in the internal buffer before ceasing to read from the underlying resource.
- **Default:** `16384` (16 KB), or `16` for `objectMode` streams.
+ **Default:** `16384` (16 KiB), or `16` for `objectMode` streams.
* `encoding` {string} If specified, then buffers will be decoded to
strings using the specified encoding. **Default:** `null`.
* `objectMode` {boolean} Whether this stream should behave
diff --git a/doc/api/util.md b/doc/api/util.md
index 2a8e48fa3ed41f..e235b8f338e557 100644
--- a/doc/api/util.md
+++ b/doc/api/util.md
@@ -536,7 +536,7 @@ changes:
description: The `depth` default changed to `20`.
- version: v11.0.0
pr-url: https://github.com/nodejs/node/pull/22756
- description: The inspection output is now limited to about 128 MB. Data
+ description: The inspection output is now limited to about 128 MiB. Data
above that size will not be fully inspected.
- version: v10.12.0
pr-url: https://github.com/nodejs/node/pull/22788
@@ -778,7 +778,7 @@ console.log(thousand, million, bigNumber, bigDecimal);
```
`util.inspect()` is a synchronous method intended for debugging. Its maximum
-output length is approximately 128 MB. Inputs that result in longer output will
+output length is approximately 128 MiB. Inputs that result in longer output will
be truncated.
### Customizing `util.inspect` colors
diff --git a/doc/contributing/investigating-native-memory-leaks.md b/doc/contributing/investigating-native-memory-leaks.md
index f9345b092737fa..17389c6bc91a7e 100644
--- a/doc/contributing/investigating-native-memory-leaks.md
+++ b/doc/contributing/investigating-native-memory-leaks.md
@@ -101,7 +101,7 @@ Leaks can be introduced in native addons and the following is a simple
example leak based on the "Hello world" addon from
[node-addon-examples](https://github.com/nodejs/node-addon-examples).
-In this example, a loop which allocates approximately 1 MB of memory and never
+In this example, a loop which allocates approximately 1 MiB of memory and never
frees it has been added:
```cpp
diff --git a/doc/node.1 b/doc/node.1
index f404747dcb84df..2003bc8ca79127 100644
--- a/doc/node.1
+++ b/doc/node.1
@@ -270,7 +270,7 @@ This flag is inherited from V8 and is subject to change upstream. It may
disappear in a non-semver-major release.
.
.It Fl -max-http-header-size Ns = Ns Ar size
-Specify the maximum size of HTTP headers in bytes. Defaults to 16 KB.
+Specify the maximum size of HTTP headers in bytes. Defaults to 16 KiB.
.
.It Fl -napi-modules
This option is a no-op.
diff --git a/lib/assert.js b/lib/assert.js
index bbd3c283c5f0e9..2c7cf369a87af2 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -213,7 +213,7 @@ function getCode(fd, line, column) {
let lines = 0;
// Prevent blocking the event loop by limiting the maximum amount of
// data that may be read.
- let maxReads = 32; // bytesPerRead * maxReads = 512 kb
+ let maxReads = 32; // bytesPerRead * maxReads = 512 KiB
const bytesPerRead = 16384;
// Use a single buffer up front that is reused until the call site is found.
let buffer = Buffer.allocUnsafe(bytesPerRead);
diff --git a/lib/fs.js b/lib/fs.js
index 405c206d56685c..7b10c3d9f43302 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -2879,7 +2879,7 @@ function lazyLoadStreams() {
/**
* Creates a readable stream with a default `highWaterMark`
- * of 64 kb.
+ * of 64 KiB.
* @param {string | Buffer | URL} path
* @param {string | {
* flags?: string;
diff --git a/lib/internal/crypto/scrypt.js b/lib/internal/crypto/scrypt.js
index 0d0ac1f7261e63..a36fb6dfba5260 100644
--- a/lib/internal/crypto/scrypt.js
+++ b/lib/internal/crypto/scrypt.js
@@ -41,7 +41,7 @@ const defaults = {
N: 16384,
r: 8,
p: 1,
- maxmem: 32 << 20, // 32 MB, matches SCRYPT_MAX_MEM.
+ maxmem: 32 << 20, // 32 MiB, matches SCRYPT_MAX_MEM.
};
function scrypt(password, salt, keylen, options, callback = defaults) {
diff --git a/lib/internal/errors.js b/lib/internal/errors.js
index 434576bde163dc..1dfa36e5f36a96 100644
--- a/lib/internal/errors.js
+++ b/lib/internal/errors.js
@@ -1004,7 +1004,7 @@ E('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY',
'Cannot overwrite symlink in subdirectory of self', SystemError);
E('ERR_FS_CP_UNKNOWN', 'Cannot copy an unknown file type', SystemError);
E('ERR_FS_EISDIR', 'Path is a directory', SystemError);
-E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GB', RangeError);
+E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GiB', RangeError);
E('ERR_FS_INVALID_SYMLINK_TYPE',
'Symlink type must be one of "dir", "file", or "junction". Received "%s"',
Error); // Switch to TypeError. The current implementation does not seem right
diff --git a/lib/internal/fs/utils.js b/lib/internal/fs/utils.js
index 61670011372bb7..e570b42da88204 100644
--- a/lib/internal/fs/utils.js
+++ b/lib/internal/fs/utils.js
@@ -122,7 +122,7 @@ const kMaximumCopyMode = COPYFILE_EXCL |
COPYFILE_FICLONE |
COPYFILE_FICLONE_FORCE;
-// Most platforms don't allow reads or writes >= 2 GB.
+// Most platforms don't allow reads or writes >= 2 GiB.
// See https://github.com/libuv/libuv/pull/1501.
const kIoMaxLength = 2 ** 31 - 1;
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index 5fc533741d7c8d..34bb11e7d7122c 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -97,11 +97,11 @@ static int StartDebugSignalHandler() {
pthread_attr_t attr;
CHECK_EQ(0, pthread_attr_init(&attr));
#if defined(PTHREAD_STACK_MIN) && !defined(__FreeBSD__)
- // PTHREAD_STACK_MIN is 2 KB with musl libc, which is too small to safely
- // receive signals. PTHREAD_STACK_MIN + MINSIGSTKSZ is 8 KB on arm64, which
+ // PTHREAD_STACK_MIN is 2 KiB with musl libc, which is too small to safely
+ // receive signals. PTHREAD_STACK_MIN + MINSIGSTKSZ is 8 KiB on arm64, which
// is the musl architecture with the biggest MINSIGSTKSZ so let's use that
// as a lower bound and let's quadruple it just in case. The goal is to avoid
- // creating a big 2 or 4 MB address space gap (problematic on 32 bits
+ // creating a big 2 or 4 MiB address space gap (problematic on 32 bits
// because of fragmentation), not squeeze out every last byte.
// Omitted on FreeBSD because it doesn't seem to like small stacks.
const size_t stack_size = std::max(static_cast(4 * 8192),
diff --git a/test/common/README.md b/test/common/README.md
index 858e782eb36902..af29f2e1bf19f6 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -59,7 +59,7 @@ On non-Windows platforms, this always returns `true`.
### `createZeroFilledFile(filename)`
-Creates a 10 MB file of all null characters.
+Creates a 10 MiB file of all null characters.
### `enoughTestMem`
diff --git a/test/parallel/test-crypto-scrypt.js b/test/parallel/test-crypto-scrypt.js
index 5f860c75bbebf0..9e5e46164fb05c 100644
--- a/test/parallel/test-crypto-scrypt.js
+++ b/test/parallel/test-crypto-scrypt.js
@@ -24,7 +24,7 @@ const good = [
},
// Test vectors from https://tools.ietf.org/html/rfc7914#page-13 that
// should pass. Note that the test vector with N=1048576 is omitted
- // because it takes too long to complete and uses over 1 GB of memory.
+ // because it takes too long to complete and uses over 1 GiB of memory.
{
pass: '',
salt: '',
diff --git a/test/parallel/test-fs-util-validateoffsetlength.js b/test/parallel/test-fs-util-validateoffsetlength.js
index 28e087d33aec7b..bda20f86683723 100644
--- a/test/parallel/test-fs-util-validateoffsetlength.js
+++ b/test/parallel/test-fs-util-validateoffsetlength.js
@@ -50,7 +50,7 @@ const {
);
}
-// Most platforms don't allow reads or writes >= 2 GB.
+// Most platforms don't allow reads or writes >= 2 GiB.
// See https://github.com/libuv/libuv/pull/1501.
const kIoMaxLength = 2 ** 31 - 1;
diff --git a/test/parallel/test-http2-max-session-memory-leak.js b/test/parallel/test-http2-max-session-memory-leak.js
index b066ca80bc5eab..476c605783c81c 100644
--- a/test/parallel/test-http2-max-session-memory-leak.js
+++ b/test/parallel/test-http2-max-session-memory-leak.js
@@ -9,7 +9,7 @@ const http2 = require('http2');
// mechanism.
const bodyLength = 8192;
-const maxSessionMemory = 1; // 1 MB
+const maxSessionMemory = 1; // 1 MiB
const requestCount = 1000;
const server = http2.createServer({ maxSessionMemory });
diff --git a/test/parallel/test-tls-securepair-leak.js b/test/parallel/test-tls-securepair-leak.js
index 4cd927d64ac088..98bdcde76ec034 100644
--- a/test/parallel/test-tls-securepair-leak.js
+++ b/test/parallel/test-tls-securepair-leak.js
@@ -20,9 +20,9 @@ setImmediate(() => {
global.gc();
const after = process.memoryUsage().external;
- // It's not an exact science but a SecurePair grows .external by about 45 kB.
+ // It's not an exact science but a SecurePair grows .external by about 45 KiB.
// Unless AdjustAmountOfExternalAllocatedMemory() is called on destruction,
- // 10,000 instances make it grow by well over 400 MB. Allow for some slop
+ // 10,000 instances make it grow by well over 400 MiB. Allow for some slop
// because objects like buffers also affect the external limit.
assert(after - before < 25 << 20);
});
diff --git a/tools/compress_json.py b/tools/compress_json.py
index dfe64063aeaead..fdb3d536cf3e3c 100644
--- a/tools/compress_json.py
+++ b/tools/compress_json.py
@@ -21,7 +21,7 @@
# To make decompression a little easier, we prepend the compressed data
# with the size of the uncompressed data as a 24 bits BE unsigned integer.
- assert len(text) < 1 << 24, 'Uncompressed JSON must be < 16 MB.'
+ assert len(text) < 1 << 24, 'Uncompressed JSON must be < 16 MiB.'
data = struct.pack('>I', len(text))[1:4] + data
step = 20
diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py
index d173bf22990116..3db3771ac97855 100644
--- a/tools/gyp/pylib/gyp/generator/ninja.py
+++ b/tools/gyp/pylib/gyp/generator/ninja.py
@@ -2112,8 +2112,8 @@ class MEMORYSTATUSEX(ctypes.Structure):
ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat))
# VS 2015 uses 20% more working set than VS 2013 and can consume all RAM
- # on a 64 GB machine.
- mem_limit = max(1, stat.ullTotalPhys // (5 * (2 ** 30))) # total / 5GB
+ # on a 64 GiB machine.
+ mem_limit = max(1, stat.ullTotalPhys // (5 * (2 ** 30))) # total / 5GiB
hard_cap = max(1, int(os.environ.get("GYP_LINK_CONCURRENCY_MAX", 2 ** 32)))
return min(mem_limit, hard_cap)
elif sys.platform.startswith("linux"):
diff --git a/tools/inspector_protocol/encoding/encoding.h b/tools/inspector_protocol/encoding/encoding.h
index 08596e9e1e43f0..14432484d55b9d 100644
--- a/tools/inspector_protocol/encoding/encoding.h
+++ b/tools/inspector_protocol/encoding/encoding.h
@@ -167,7 +167,7 @@ namespace cbor {
// must use a 32 bit wide length.
// - At the top level, a message must be an indefinite length map
// wrapped by an envelope.
-// - Maximal size for messages is 2^32 (4 GB).
+// - Maximal size for messages is 2^32 (4 GiB).
// - For scalars, we support only the int32_t range, encoded as
// UNSIGNED/NEGATIVE (major types 0 / 1).
// - UTF16 strings, including with unbalanced surrogate pairs, are encoded
diff --git a/tools/inspector_protocol/lib/encoding_h.template b/tools/inspector_protocol/lib/encoding_h.template
index 2c6cfc10d594c2..4d9874bfbd5cb4 100644
--- a/tools/inspector_protocol/lib/encoding_h.template
+++ b/tools/inspector_protocol/lib/encoding_h.template
@@ -176,7 +176,7 @@ namespace cbor {
// must use a 32 bit wide length.
// - At the top level, a message must be an indefinite length map
// wrapped by an envelope.
-// - Maximal size for messages is 2^32 (4 GB).
+// - Maximal size for messages is 2^32 (4 GiB).
// - For scalars, we support only the int32_t range, encoded as
// UNSIGNED/NEGATIVE (major types 0 / 1).
// - UTF16 strings, including with unbalanced surrogate pairs, are encoded
diff --git a/tools/msvs/install_tools/install_tools.bat b/tools/msvs/install_tools/install_tools.bat
index 46ba93c8b890c9..18f92a981003f2 100644
--- a/tools/msvs/install_tools/install_tools.bat
+++ b/tools/msvs/install_tools/install_tools.bat
@@ -13,7 +13,7 @@ echo This script will install Python and the Visual Studio Build Tools, necessar
echo to compile Node.js native modules. Note that Chocolatey and required Windows
echo updates will also be installed.
echo.
-echo This will require about 3 Gb of free disk space, plus any space necessary to
+echo This will require about 3 GiB of free disk space, plus any space necessary to
echo install Windows updates. This will take a while to run.
echo.
echo Please close all open programs for the duration of the installation. If the
diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi
index cb3c9dd0f5f997..2936f7181f364e 100644
--- a/tools/v8_gypfiles/features.gypi
+++ b/tools/v8_gypfiles/features.gypi
@@ -275,7 +275,7 @@
# will fail.
'v8_enable_webassembly%': 1,
- # Enable advanced BigInt algorithms, costing about 10-30 KB binary size
+ # Enable advanced BigInt algorithms, costing about 10-30 KiB binary size
# depending on platform.
'v8_advanced_bigint_algorithms%': 1
},