Skip to content

Commit 025b3e7

Browse files
aduh95targos
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 <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Paolo Insogna <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Mestery <[email protected]>
1 parent d311916 commit 025b3e7

26 files changed

+46
-46
lines changed

doc/api/buffer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ _may contain sensitive data_. Use [`buf.fill(0)`][`buf.fill()`] to initialize
833833
such `Buffer` instances with zeroes.
834834

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

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

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

52115211
It reflects [`v8::TypedArray::kMaxLength`][] under the hood.
52125212

doc/api/cli.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,10 @@ added:
666666
changes:
667667
- version: v13.13.0
668668
pr-url: https://github.com/nodejs/node/pull/32520
669-
description: Change maximum default size of HTTP headers from 8 KB to 16 KB.
669+
description: Change maximum default size of HTTP headers from 8 KiB to 16 KiB.
670670
-->
671671

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

674674
### `--napi-modules`
675675

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

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

19991999
```console
20002000
$ node --max-old-space-size=1536 index.js

doc/api/errors.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,11 +2951,11 @@ changes:
29512951
- v10.15.0
29522952
commit: 186035243fad247e3955f
29532953
pr-url: https://github.com/nodejs-private/node-private/pull/143
2954-
description: Max header size in `http_parser` was set to 8 KB.
2954+
description: Max header size in `http_parser` was set to 8 KiB.
29552955
-->
29562956

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

doc/api/fs.md

Lines changed: 6 additions & 6 deletions
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
@@ -2186,8 +2186,8 @@ changes:
21862186
* `fs` {Object|null} **Default:** `null`
21872187
* Returns: {fs.ReadStream}
21882188
2189-
Unlike the 16 kb default `highWaterMark` for a {stream.Readable}, the stream
2190-
returned by this method has a default `highWaterMark` of 64 kb.
2189+
Unlike the 16 KiB default `highWaterMark` for a {stream.Readable}, the stream
2190+
returned by this method has a default `highWaterMark` of 64 KiB.
21912191
21922192
`options` can include `start` and `end` values to read a range of bytes from
21932193
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.
34303430
The additional read overhead can vary broadly on different systems and depends
34313431
on the type of file being read. If the file type is not a regular file (a pipe
34323432
for instance) and Node.js is unable to determine an actual file size, each read
3433-
operation will load on 64 KB of data. For regular files, each read will process
3434-
512 KB of data.
3433+
operation will load on 64 KiB of data. For regular files, each read will process
3434+
512 KiB of data.
34353435

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

doc/api/http.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2998,7 +2998,7 @@ changes:
29982998
* `maxHeaderSize` {number} Optionally overrides the value of
29992999
[`--max-http-header-size`][] for requests received by this server, i.e.
30003000
the maximum length of request headers in bytes.
3001-
**Default:** 16384 (16 KB).
3001+
**Default:** 16384 (16 KiB).
30023002
* `noDelay` {boolean} If set to `true`, it disables the use of Nagle's
30033003
algorithm immediately after a new incoming connection is received.
30043004
**Default:** `true`.
@@ -3154,7 +3154,7 @@ added:
31543154
* {number}
31553155

31563156
Read-only property specifying the maximum allowed size of HTTP headers in bytes.
3157-
Defaults to 16 KB. Configurable using the [`--max-http-header-size`][] CLI
3157+
Defaults to 16 KiB. Configurable using the [`--max-http-header-size`][] CLI
31583158
option.
31593159

31603160
This can be overridden for servers and client requests by passing the
@@ -3231,7 +3231,7 @@ changes:
32313231
* `maxHeaderSize` {number} Optionally overrides the value of
32323232
[`--max-http-header-size`][] (the maximum length of response headers in
32333233
bytes) for responses received from the server.
3234-
**Default:** 16384 (16 KB).
3234+
**Default:** 16384 (16 KiB).
32353235
* `method` {string} A string specifying the HTTP request method. **Default:**
32363236
`'GET'`.
32373237
* `path` {string} Request path. Should include query string if any.

doc/api/stream.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,7 +1674,7 @@ If the loop terminates with a `break`, `return`, or a `throw`, the stream will
16741674
be destroyed. In other terms, iterating over a stream will consume the stream
16751675
fully. The stream will be read in chunks of size equal to the `highWaterMark`
16761676
option. In the code example above, data will be in a single chunk if the file
1677-
has less then 64 KB of data because no `highWaterMark` option is provided to
1677+
has less then 64 KiB of data because no `highWaterMark` option is provided to
16781678
[`fs.createReadStream()`][].
16791679

16801680
##### `readable.iterator([options])`
@@ -3047,7 +3047,7 @@ changes:
30473047
* `options` {Object}
30483048
* `highWaterMark` {number} Buffer level when
30493049
[`stream.write()`][stream-write] starts returning `false`. **Default:**
3050-
`16384` (16 KB), or `16` for `objectMode` streams.
3050+
`16384` (16 KiB), or `16` for `objectMode` streams.
30513051
* `decodeStrings` {boolean} Whether to encode `string`s passed to
30523052
[`stream.write()`][stream-write] to `Buffer`s (with the encoding
30533053
specified in the [`stream.write()`][stream-write] call) before passing
@@ -3420,7 +3420,7 @@ changes:
34203420
* `options` {Object}
34213421
* `highWaterMark` {number} The maximum [number of bytes][hwm-gotcha] to store
34223422
in the internal buffer before ceasing to read from the underlying resource.
3423-
**Default:** `16384` (16 KB), or `16` for `objectMode` streams.
3423+
**Default:** `16384` (16 KiB), or `16` for `objectMode` streams.
34243424
* `encoding` {string} If specified, then buffers will be decoded to
34253425
strings using the specified encoding. **Default:** `null`.
34263426
* `objectMode` {boolean} Whether this stream should behave

doc/api/util.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ changes:
536536
description: The `depth` default changed to `20`.
537537
- version: v11.0.0
538538
pr-url: https://github.com/nodejs/node/pull/22756
539-
description: The inspection output is now limited to about 128 MB. Data
539+
description: The inspection output is now limited to about 128 MiB. Data
540540
above that size will not be fully inspected.
541541
- version: v10.12.0
542542
pr-url: https://github.com/nodejs/node/pull/22788
@@ -778,7 +778,7 @@ console.log(thousand, million, bigNumber, bigDecimal);
778778
```
779779

780780
`util.inspect()` is a synchronous method intended for debugging. Its maximum
781-
output length is approximately 128 MB. Inputs that result in longer output will
781+
output length is approximately 128 MiB. Inputs that result in longer output will
782782
be truncated.
783783

784784
### Customizing `util.inspect` colors

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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);

0 commit comments

Comments
 (0)