Skip to content

Commit 9e20318

Browse files
aduh95juanarbol
authored andcommitted
doc: consolidate use of multiple-byte units
Refs: https://en.wikipedia.org/wiki/Byte#Multiple-byte_units PR-URL: #42587 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com>
1 parent 30a93db commit 9e20318

26 files changed

+46
-46
lines changed

doc/api/buffer.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ _may contain sensitive data_. Use [`buf.fill(0)`][`buf.fill()`] to initialize
815815
such `Buffer` instances with zeroes.
816816

817817
When using [`Buffer.allocUnsafe()`][] to allocate new `Buffer` instances,
818-
allocations under 4 KB are sliced from a single pre-allocated `Buffer`. This
818+
allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
819819
allows applications to avoid the garbage collection overhead of creating many
820820
individually allocated `Buffer` instances. This approach improves both
821821
performance and memory usage by eliminating the need to track and clean up as
@@ -5182,9 +5182,9 @@ changes:
51825182
* {integer} The largest size allowed for a single `Buffer` instance.
51835183

51845184
On 32-bit architectures, this value currently is 2<sup>30</sup> - 1 (about 1
5185-
GB).
5185+
GiB).
51865186

5187-
On 64-bit architectures, this value currently is 2<sup>32</sup> (about 4 GB).
5187+
On 64-bit architectures, this value currently is 2<sup>32</sup> (about 4 GiB).
51885188

51895189
It reflects [`v8::TypedArray::kMaxLength`][] under the hood.
51905190

doc/api/cli.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,10 @@ added:
656656
changes:
657657
- version: v13.13.0
658658
pr-url: https://github.com/nodejs/node/pull/32520
659-
description: Change maximum default size of HTTP headers from 8 KB to 16 KB.
659+
description: Change maximum default size of HTTP headers from 8 KiB to 16 KiB.
660660
-->
661661

662-
Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KB.
662+
Specify the maximum size, in bytes, of HTTP headers. Defaults to 16 KiB.
663663

664664
### `--napi-modules`
665665

@@ -1940,8 +1940,8 @@ Sets the max memory size of V8's old memory section. As memory
19401940
consumption approaches the limit, V8 will spend more time on
19411941
garbage collection in an effort to free unused memory.
19421942

1943-
On a machine with 2 GB of memory, consider setting this to
1944-
1536 (1.5 GB) to leave some memory for other uses and avoid swapping.
1943+
On a machine with 2 GiB of memory, consider setting this to
1944+
1536 (1.5 GiB) to leave some memory for other uses and avoid swapping.
19451945

19461946
```console
19471947
$ node --max-old-space-size=1536 index.js

doc/api/errors.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2914,11 +2914,11 @@ changes:
29142914
- v10.15.0
29152915
commit: 186035243fad247e3955f
29162916
pr-url: https://github.com/nodejs-private/node-private/pull/143
2917-
description: Max header size in `http_parser` was set to 8 KB.
2917+
description: Max header size in `http_parser` was set to 8 KiB.
29182918
-->
29192919

29202920
Too much HTTP header data was received. In order to protect against malicious or
2921-
malconfigured clients, if more than 8 KB of HTTP header data is received then
2921+
malconfigured clients, if more than 8 KiB of HTTP header data is received then
29222922
HTTP parsing will abort without a request or response object being created, and
29232923
an `Error` with this code will be emitted.
29242924

doc/api/fs.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ added: v16.11.0
262262
* `highWaterMark` {integer} **Default:** `64 * 1024`
263263
* Returns: {fs.ReadStream}
264264
265-
Unlike the 16 kb default `highWaterMark` for a {stream.Readable}, the stream
266-
returned by this method has a default `highWaterMark` of 64 kb.
265+
Unlike the 16 KiB default `highWaterMark` for a {stream.Readable}, the stream
266+
returned by this method has a default `highWaterMark` of 64 KiB.
267267
268268
`options` can include `start` and `end` values to read a range of bytes from
269269
the file instead of the entire file. Both `start` and `end` are inclusive and
@@ -2094,8 +2094,8 @@ changes:
20942094
* `fs` {Object|null} **Default:** `null`
20952095
* Returns: {fs.ReadStream}
20962096
2097-
Unlike the 16 kb default `highWaterMark` for a {stream.Readable}, the stream
2098-
returned by this method has a default `highWaterMark` of 64 kb.
2097+
Unlike the 16 KiB default `highWaterMark` for a {stream.Readable}, the stream
2098+
returned by this method has a default `highWaterMark` of 64 KiB.
20992099
21002100
`options` can include `start` and `end` values to read a range of bytes from
21012101
the file instead of the entire file. Both `start` and `end` are inclusive and
@@ -3233,8 +3233,8 @@ to read a complete file into memory.
32333233
The additional read overhead can vary broadly on different systems and depends
32343234
on the type of file being read. If the file type is not a regular file (a pipe
32353235
for instance) and Node.js is unable to determine an actual file size, each read
3236-
operation will load on 64 KB of data. For regular files, each read will process
3237-
512 KB of data.
3236+
operation will load on 64 KiB of data. For regular files, each read will process
3237+
512 KiB of data.
32383238

32393239
For applications that require as-fast-as-possible reading of file contents, it
32403240
is better to use `fs.read()` directly and for application code to manage

doc/api/http.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2959,7 +2959,7 @@ changes:
29592959
* `maxHeaderSize` {number} Optionally overrides the value of
29602960
[`--max-http-header-size`][] for requests received by this server, i.e.
29612961
the maximum length of request headers in bytes.
2962-
**Default:** 16384 (16 KB).
2962+
**Default:** 16384 (16 KiB).
29632963
* `noDelay` {boolean} If set to `true`, it disables the use of Nagle's
29642964
algorithm immediately after a new incoming connection is received.
29652965
**Default:** `false`.
@@ -3115,7 +3115,7 @@ added:
31153115
* {number}
31163116

31173117
Read-only property specifying the maximum allowed size of HTTP headers in bytes.
3118-
Defaults to 16 KB. Configurable using the [`--max-http-header-size`][] CLI
3118+
Defaults to 16 KiB. Configurable using the [`--max-http-header-size`][] CLI
31193119
option.
31203120

31213121
This can be overridden for servers and client requests by passing the
@@ -3190,7 +3190,7 @@ changes:
31903190
* `maxHeaderSize` {number} Optionally overrides the value of
31913191
[`--max-http-header-size`][] (the maximum length of response headers in
31923192
bytes) for responses received from the server.
3193-
**Default:** 16384 (16 KB).
3193+
**Default:** 16384 (16 KiB).
31943194
* `method` {string} A string specifying the HTTP request method. **Default:**
31953195
`'GET'`.
31963196
* `path` {string} Request path. Should include query string if any.

doc/api/stream.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ If the loop terminates with a `break`, `return`, or a `throw`, the stream will
16281628
be destroyed. In other terms, iterating over a stream will consume the stream
16291629
fully. The stream will be read in chunks of size equal to the `highWaterMark`
16301630
option. In the code example above, data will be in a single chunk if the file
1631-
has less then 64 KB of data because no `highWaterMark` option is provided to
1631+
has less then 64 KiB of data because no `highWaterMark` option is provided to
16321632
[`fs.createReadStream()`][].
16331633

16341634
##### `readable.iterator([options])`
@@ -2891,7 +2891,7 @@ changes:
28912891
* `options` {Object}
28922892
* `highWaterMark` {number} Buffer level when
28932893
[`stream.write()`][stream-write] starts returning `false`. **Default:**
2894-
`16384` (16 KB), or `16` for `objectMode` streams.
2894+
`16384` (16 KiB), or `16` for `objectMode` streams.
28952895
* `decodeStrings` {boolean} Whether to encode `string`s passed to
28962896
[`stream.write()`][stream-write] to `Buffer`s (with the encoding
28972897
specified in the [`stream.write()`][stream-write] call) before passing
@@ -3264,7 +3264,7 @@ changes:
32643264
* `options` {Object}
32653265
* `highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store
32663266
in the internal buffer before ceasing to read from the underlying resource.
3267-
**Default:** `16384` (16 KB), or `16` for `objectMode` streams.
3267+
**Default:** `16384` (16 KiB), or `16` for `objectMode` streams.
32683268
* `encoding` {string} If specified, then buffers will be decoded to
32693269
strings using the specified encoding. **Default:** `null`.
32703270
* `objectMode` {boolean} Whether this stream should behave

doc/api/util.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ changes:
532532
description: The `depth` default changed to `20`.
533533
- version: v11.0.0
534534
pr-url: https://github.com/nodejs/node/pull/22756
535-
description: The inspection output is now limited to about 128 MB. Data
535+
description: The inspection output is now limited to about 128 MiB. Data
536536
above that size will not be fully inspected.
537537
- version: v10.12.0
538538
pr-url: https://github.com/nodejs/node/pull/22788
@@ -774,7 +774,7 @@ console.log(thousand, million, bigNumber, bigDecimal);
774774
```
775775

776776
`util.inspect()` is a synchronous method intended for debugging. Its maximum
777-
output length is approximately 128 MB. Inputs that result in longer output will
777+
output length is approximately 128 MiB. Inputs that result in longer output will
778778
be truncated.
779779

780780
### Customizing `util.inspect` colors

doc/contributing/investigating-native-memory-leaks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Leaks can be introduced in native addons and the following is a simple
101101
example leak based on the "Hello world" addon from
102102
[node-addon-examples](https://github.com/nodejs/node-addon-examples).
103103

104-
In this example, a loop which allocates approximately 1 MB of memory and never
104+
In this example, a loop which allocates approximately 1 MiB of memory and never
105105
frees it has been added:
106106

107107
```cpp

doc/node.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ This flag is inherited from V8 and is subject to change upstream. It may
270270
disappear in a non-semver-major release.
271271
.
272272
.It Fl -max-http-header-size Ns = Ns Ar size
273-
Specify the maximum size of HTTP headers in bytes. Defaults to 16 KB.
273+
Specify the maximum size of HTTP headers in bytes. Defaults to 16 KiB.
274274
.
275275
.It Fl -napi-modules
276276
This option is a no-op.

lib/assert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ function getCode(fd, line, column) {
213213
let lines = 0;
214214
// Prevent blocking the event loop by limiting the maximum amount of
215215
// data that may be read.
216-
let maxReads = 32; // bytesPerRead * maxReads = 512 kb
216+
let maxReads = 32; // bytesPerRead * maxReads = 512 KiB
217217
const bytesPerRead = 16384;
218218
// Use a single buffer up front that is reused until the call site is found.
219219
let buffer = Buffer.allocUnsafe(bytesPerRead);

lib/fs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2866,7 +2866,7 @@ function lazyLoadStreams() {
28662866

28672867
/**
28682868
* Creates a readable stream with a default `highWaterMark`
2869-
* of 64 kb.
2869+
* of 64 KiB.
28702870
* @param {string | Buffer | URL} path
28712871
* @param {string | {
28722872
* flags?: string;

lib/internal/crypto/scrypt.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const defaults = {
4141
N: 16384,
4242
r: 8,
4343
p: 1,
44-
maxmem: 32 << 20, // 32 MB, matches SCRYPT_MAX_MEM.
44+
maxmem: 32 << 20, // 32 MiB, matches SCRYPT_MAX_MEM.
4545
};
4646

4747
function scrypt(password, salt, keylen, options, callback = defaults) {

lib/internal/errors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ E('ERR_FS_CP_SYMLINK_TO_SUBDIRECTORY',
990990
'Cannot overwrite symlink in subdirectory of self', SystemError);
991991
E('ERR_FS_CP_UNKNOWN', 'Cannot copy an unknown file type', SystemError);
992992
E('ERR_FS_EISDIR', 'Path is a directory', SystemError);
993-
E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GB', RangeError);
993+
E('ERR_FS_FILE_TOO_LARGE', 'File size (%s) is greater than 2 GiB', RangeError);
994994
E('ERR_FS_INVALID_SYMLINK_TYPE',
995995
'Symlink type must be one of "dir", "file", or "junction". Received "%s"',
996996
Error); // Switch to TypeError. The current implementation does not seem right

lib/internal/fs/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ const kMaximumCopyMode = COPYFILE_EXCL |
122122
COPYFILE_FICLONE |
123123
COPYFILE_FICLONE_FORCE;
124124

125-
// Most platforms don't allow reads or writes >= 2 GB.
125+
// Most platforms don't allow reads or writes >= 2 GiB.
126126
// See https://github.com/libuv/libuv/pull/1501.
127127
const kIoMaxLength = 2 ** 31 - 1;
128128

src/inspector_agent.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ static int StartDebugSignalHandler() {
9797
pthread_attr_t attr;
9898
CHECK_EQ(0, pthread_attr_init(&attr));
9999
#if defined(PTHREAD_STACK_MIN) && !defined(__FreeBSD__)
100-
// PTHREAD_STACK_MIN is 2 KB with musl libc, which is too small to safely
101-
// receive signals. PTHREAD_STACK_MIN + MINSIGSTKSZ is 8 KB on arm64, which
100+
// PTHREAD_STACK_MIN is 2 KiB with musl libc, which is too small to safely
101+
// receive signals. PTHREAD_STACK_MIN + MINSIGSTKSZ is 8 KiB on arm64, which
102102
// is the musl architecture with the biggest MINSIGSTKSZ so let's use that
103103
// as a lower bound and let's quadruple it just in case. The goal is to avoid
104-
// creating a big 2 or 4 MB address space gap (problematic on 32 bits
104+
// creating a big 2 or 4 MiB address space gap (problematic on 32 bits
105105
// because of fragmentation), not squeeze out every last byte.
106106
// Omitted on FreeBSD because it doesn't seem to like small stacks.
107107
const size_t stack_size = std::max(static_cast<size_t>(4 * 8192),

test/common/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ On non-Windows platforms, this always returns `true`.
5959

6060
### `createZeroFilledFile(filename)`
6161

62-
Creates a 10 MB file of all null characters.
62+
Creates a 10 MiB file of all null characters.
6363

6464
### `enoughTestMem`
6565

test/parallel/test-crypto-scrypt.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const good = [
2424
},
2525
// Test vectors from https://tools.ietf.org/html/rfc7914#page-13 that
2626
// should pass. Note that the test vector with N=1048576 is omitted
27-
// because it takes too long to complete and uses over 1 GB of memory.
27+
// because it takes too long to complete and uses over 1 GiB of memory.
2828
{
2929
pass: '',
3030
salt: '',

test/parallel/test-fs-util-validateoffsetlength.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const {
5050
);
5151
}
5252

53-
// Most platforms don't allow reads or writes >= 2 GB.
53+
// Most platforms don't allow reads or writes >= 2 GiB.
5454
// See https://github.com/libuv/libuv/pull/1501.
5555
const kIoMaxLength = 2 ** 31 - 1;
5656

test/parallel/test-http2-max-session-memory-leak.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const http2 = require('http2');
99
// mechanism.
1010

1111
const bodyLength = 8192;
12-
const maxSessionMemory = 1; // 1 MB
12+
const maxSessionMemory = 1; // 1 MiB
1313
const requestCount = 1000;
1414

1515
const server = http2.createServer({ maxSessionMemory });

test/parallel/test-tls-securepair-leak.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ setImmediate(() => {
2020
global.gc();
2121
const after = process.memoryUsage().external;
2222

23-
// It's not an exact science but a SecurePair grows .external by about 45 kB.
23+
// It's not an exact science but a SecurePair grows .external by about 45 KiB.
2424
// Unless AdjustAmountOfExternalAllocatedMemory() is called on destruction,
25-
// 10,000 instances make it grow by well over 400 MB. Allow for some slop
25+
// 10,000 instances make it grow by well over 400 MiB. Allow for some slop
2626
// because objects like buffers also affect the external limit.
2727
assert(after - before < 25 << 20);
2828
});

tools/compress_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# To make decompression a little easier, we prepend the compressed data
2323
# with the size of the uncompressed data as a 24 bits BE unsigned integer.
24-
assert len(text) < 1 << 24, 'Uncompressed JSON must be < 16 MB.'
24+
assert len(text) < 1 << 24, 'Uncompressed JSON must be < 16 MiB.'
2525
data = struct.pack('>I', len(text))[1:4] + data
2626

2727
step = 20

tools/gyp/pylib/gyp/generator/ninja.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2112,8 +2112,8 @@ class MEMORYSTATUSEX(ctypes.Structure):
21122112
ctypes.windll.kernel32.GlobalMemoryStatusEx(ctypes.byref(stat))
21132113

21142114
# VS 2015 uses 20% more working set than VS 2013 and can consume all RAM
2115-
# on a 64 GB machine.
2116-
mem_limit = max(1, stat.ullTotalPhys // (5 * (2 ** 30))) # total / 5GB
2115+
# on a 64 GiB machine.
2116+
mem_limit = max(1, stat.ullTotalPhys // (5 * (2 ** 30))) # total / 5GiB
21172117
hard_cap = max(1, int(os.environ.get("GYP_LINK_CONCURRENCY_MAX", 2 ** 32)))
21182118
return min(mem_limit, hard_cap)
21192119
elif sys.platform.startswith("linux"):

tools/inspector_protocol/encoding/encoding.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ namespace cbor {
167167
// must use a 32 bit wide length.
168168
// - At the top level, a message must be an indefinite length map
169169
// wrapped by an envelope.
170-
// - Maximal size for messages is 2^32 (4 GB).
170+
// - Maximal size for messages is 2^32 (4 GiB).
171171
// - For scalars, we support only the int32_t range, encoded as
172172
// UNSIGNED/NEGATIVE (major types 0 / 1).
173173
// - UTF16 strings, including with unbalanced surrogate pairs, are encoded

tools/inspector_protocol/lib/encoding_h.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ namespace cbor {
176176
// must use a 32 bit wide length.
177177
// - At the top level, a message must be an indefinite length map
178178
// wrapped by an envelope.
179-
// - Maximal size for messages is 2^32 (4 GB).
179+
// - Maximal size for messages is 2^32 (4 GiB).
180180
// - For scalars, we support only the int32_t range, encoded as
181181
// UNSIGNED/NEGATIVE (major types 0 / 1).
182182
// - UTF16 strings, including with unbalanced surrogate pairs, are encoded

tools/msvs/install_tools/install_tools.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ echo This script will install Python and the Visual Studio Build Tools, necessar
1313
echo to compile Node.js native modules. Note that Chocolatey and required Windows
1414
echo updates will also be installed.
1515
echo.
16-
echo This will require about 3 Gb of free disk space, plus any space necessary to
16+
echo This will require about 3 GiB of free disk space, plus any space necessary to
1717
echo install Windows updates. This will take a while to run.
1818
echo.
1919
echo Please close all open programs for the duration of the installation. If the

tools/v8_gypfiles/features.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
# will fail.
254254
'v8_enable_webassembly%': 1,
255255

256-
# Enable advanced BigInt algorithms, costing about 10-30 KB binary size
256+
# Enable advanced BigInt algorithms, costing about 10-30 KiB binary size
257257
# depending on platform.
258258
'v8_advanced_bigint_algorithms%': 1
259259
},

0 commit comments

Comments
 (0)