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 <[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 30a93db commit 9e20318

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
@@ -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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 2 additions & 2 deletions
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

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
@@ -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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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

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)