@types/node 16.18.81 → 16.18.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,7 @@
10
10
  * recommended to explicitly reference it via an import or require statement.
11
11
  *
12
12
  * ```js
13
- * import { Buffer } from 'buffer';
13
+ * import { Buffer } from 'node:buffer';
14
14
  *
15
15
  * // Creates a zero-filled Buffer of length 10.
16
16
  * const buf1 = Buffer.alloc(10);
@@ -41,7 +41,7 @@
41
41
  * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
42
42
  * const buf7 = Buffer.from('tést', 'latin1');
43
43
  * ```
44
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/buffer.js)
44
+ * @see [source](https://github.com/nodejs/node/blob/v16.20.2/lib/buffer.js)
45
45
  */
46
46
  declare module "buffer" {
47
47
  import { BinaryLike } from "node:crypto";
@@ -67,7 +67,7 @@ declare module "buffer" {
67
67
  * sequence cannot be adequately represented in the target encoding. For instance:
68
68
  *
69
69
  * ```js
70
- * import { Buffer, transcode } from 'buffer';
70
+ * import { Buffer, transcode } from 'node:buffer';
71
71
  *
72
72
  * const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii');
73
73
  * console.log(newBuf.toString('ascii'));
@@ -101,9 +101,10 @@ declare module "buffer" {
101
101
  */
102
102
  export interface BlobOptions {
103
103
  /**
104
- * @default 'utf8'
104
+ * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
105
+ * will be converted to the platform native line-ending as specified by `require('node:os').EOL`.
105
106
  */
106
- encoding?: BufferEncoding | undefined;
107
+ endings?: "transparent" | "native";
107
108
  /**
108
109
  * The Blob content-type. The intent is for `type` to convey
109
110
  * the MIME media type of the data, however no validation of the type format
@@ -115,7 +116,6 @@ declare module "buffer" {
115
116
  * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
116
117
  * multiple worker threads.
117
118
  * @since v15.7.0
118
- * @experimental
119
119
  */
120
120
  export class Blob {
121
121
  /**
@@ -136,7 +136,7 @@ declare module "buffer" {
136
136
  *
137
137
  * String sources are also copied into the `Blob`.
138
138
  */
139
- constructor(sources: Array<BinaryLike | Blob>, options?: BlobOptions);
139
+ constructor(sources: Array<ArrayBuffer | BinaryLike | Blob>, options?: BlobOptions);
140
140
  /**
141
141
  * Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
142
142
  * the `Blob` data.
@@ -159,7 +159,7 @@ declare module "buffer" {
159
159
  */
160
160
  text(): Promise<string>;
161
161
  /**
162
- * Returns a new (WHATWG) `ReadableStream` that allows the content of the `Blob` to be read.
162
+ * Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
163
163
  * @since v16.7.0
164
164
  */
165
165
  stream(): WebReadableStream;
@@ -243,7 +243,7 @@ declare module "buffer" {
243
243
  * Array entries outside that range will be truncated to fit into it.
244
244
  *
245
245
  * ```js
246
- * import { Buffer } from 'buffer';
246
+ * import { Buffer } from 'node:buffer';
247
247
  *
248
248
  * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
249
249
  * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
@@ -288,7 +288,7 @@ declare module "buffer" {
288
288
  * Returns `true` if `obj` is a `Buffer`, `false` otherwise.
289
289
  *
290
290
  * ```js
291
- * import { Buffer } from 'buffer';
291
+ * import { Buffer } from 'node:buffer';
292
292
  *
293
293
  * Buffer.isBuffer(Buffer.alloc(10)); // true
294
294
  * Buffer.isBuffer(Buffer.from('foo')); // true
@@ -304,7 +304,7 @@ declare module "buffer" {
304
304
  * or `false` otherwise.
305
305
  *
306
306
  * ```js
307
- * import { Buffer } from 'buffer';
307
+ * import { Buffer } from 'node:buffer';
308
308
  *
309
309
  * console.log(Buffer.isEncoding('utf8'));
310
310
  * // Prints: true
@@ -333,7 +333,7 @@ declare module "buffer" {
333
333
  * string.
334
334
  *
335
335
  * ```js
336
- * import { Buffer } from 'buffer';
336
+ * import { Buffer } from 'node:buffer';
337
337
  *
338
338
  * const str = '\u00bd + \u00bc = \u00be';
339
339
  *
@@ -352,7 +352,7 @@ declare module "buffer" {
352
352
  * @return The number of bytes contained within `string`.
353
353
  */
354
354
  byteLength(
355
- string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
355
+ string: string | Buffer | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
356
356
  encoding?: BufferEncoding,
357
357
  ): number;
358
358
  /**
@@ -368,7 +368,7 @@ declare module "buffer" {
368
368
  * truncated to `totalLength`.
369
369
  *
370
370
  * ```js
371
- * import { Buffer } from 'buffer';
371
+ * import { Buffer } from 'node:buffer';
372
372
  *
373
373
  * // Create a single `Buffer` from a list of three `Buffer` instances.
374
374
  *
@@ -398,7 +398,7 @@ declare module "buffer" {
398
398
  * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
399
399
  *
400
400
  * ```js
401
- * import { Buffer } from 'buffer';
401
+ * import { Buffer } from 'node:buffer';
402
402
  *
403
403
  * const buf1 = Buffer.from('1234');
404
404
  * const buf2 = Buffer.from('0123');
@@ -411,12 +411,12 @@ declare module "buffer" {
411
411
  * @since v0.11.13
412
412
  * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details.
413
413
  */
414
- compare(buf1: Uint8Array, buf2: Uint8Array): number;
414
+ compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1;
415
415
  /**
416
416
  * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
417
417
  *
418
418
  * ```js
419
- * import { Buffer } from 'buffer';
419
+ * import { Buffer } from 'node:buffer';
420
420
  *
421
421
  * const buf = Buffer.alloc(5);
422
422
  *
@@ -429,7 +429,7 @@ declare module "buffer" {
429
429
  * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
430
430
  *
431
431
  * ```js
432
- * import { Buffer } from 'buffer';
432
+ * import { Buffer } from 'node:buffer';
433
433
  *
434
434
  * const buf = Buffer.alloc(5, 'a');
435
435
  *
@@ -441,7 +441,7 @@ declare module "buffer" {
441
441
  * initialized by calling `buf.fill(fill, encoding)`.
442
442
  *
443
443
  * ```js
444
- * import { Buffer } from 'buffer';
444
+ * import { Buffer } from 'node:buffer';
445
445
  *
446
446
  * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
447
447
  *
@@ -464,10 +464,10 @@ declare module "buffer" {
464
464
  * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown.
465
465
  *
466
466
  * The underlying memory for `Buffer` instances created in this way is _not_
467
- * _initialized_. The contents of the newly created `Buffer` are unknown and_may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
467
+ * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
468
468
  *
469
469
  * ```js
470
- * import { Buffer } from 'buffer';
470
+ * import { Buffer } from 'node:buffer';
471
471
  *
472
472
  * const buf = Buffer.allocUnsafe(10);
473
473
  *
@@ -483,8 +483,8 @@ declare module "buffer" {
483
483
  * A `TypeError` will be thrown if `size` is not a number.
484
484
  *
485
485
  * The `Buffer` module pre-allocates an internal `Buffer` instance of
486
- * size `Buffer.poolSize` that is used as a pool for the fast allocation of new`Buffer` instances created using `Buffer.allocUnsafe()`,`Buffer.from(array)`, `Buffer.concat()`, and the
487
- * deprecated`new Buffer(size)` constructor only when `size` is less than or equal
486
+ * size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`, `Buffer.concat()`, and the
487
+ * deprecated `new Buffer(size)` constructor only when `size` is less than or equal
488
488
  * to `Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two).
489
489
  *
490
490
  * Use of this pre-allocated internal memory pool is a key difference between
@@ -498,15 +498,15 @@ declare module "buffer" {
498
498
  */
499
499
  allocUnsafe(size: number): Buffer;
500
500
  /**
501
- * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown. A zero-length `Buffer` is created
502
- * if `size` is 0.
501
+ * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown. A zero-length `Buffer` is created if
502
+ * `size` is 0.
503
503
  *
504
504
  * The underlying memory for `Buffer` instances created in this way is _not_
505
- * _initialized_. The contents of the newly created `Buffer` are unknown and_may contain sensitive data_. Use `buf.fill(0)` to initialize
505
+ * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
506
506
  * such `Buffer` instances with zeroes.
507
507
  *
508
508
  * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
509
- * allocations under 4 KB are sliced from a single pre-allocated `Buffer`. This
509
+ * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
510
510
  * allows applications to avoid the garbage collection overhead of creating many
511
511
  * individually allocated `Buffer` instances. This approach improves both
512
512
  * performance and memory usage by eliminating the need to track and clean up as
@@ -518,7 +518,7 @@ declare module "buffer" {
518
518
  * then copying out the relevant bits.
519
519
  *
520
520
  * ```js
521
- * import { Buffer } from 'buffer';
521
+ * import { Buffer } from 'node:buffer';
522
522
  *
523
523
  * // Need to keep around a few small chunks of memory.
524
524
  * const store = [];
@@ -556,7 +556,7 @@ declare module "buffer" {
556
556
  * written. However, partially encoded characters will not be written.
557
557
  *
558
558
  * ```js
559
- * import { Buffer } from 'buffer';
559
+ * import { Buffer } from 'node:buffer';
560
560
  *
561
561
  * const buf = Buffer.alloc(256);
562
562
  *
@@ -592,7 +592,7 @@ declare module "buffer" {
592
592
  * as {@link constants.MAX_STRING_LENGTH}.
593
593
  *
594
594
  * ```js
595
- * import { Buffer } from 'buffer';
595
+ * import { Buffer } from 'node:buffer';
596
596
  *
597
597
  * const buf1 = Buffer.allocUnsafe(26);
598
598
  *
@@ -629,7 +629,7 @@ declare module "buffer" {
629
629
  * In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`.
630
630
  *
631
631
  * ```js
632
- * import { Buffer } from 'buffer';
632
+ * import { Buffer } from 'node:buffer';
633
633
  *
634
634
  * const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);
635
635
  * const json = JSON.stringify(buf);
@@ -656,7 +656,7 @@ declare module "buffer" {
656
656
  * Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`.
657
657
  *
658
658
  * ```js
659
- * import { Buffer } from 'buffer';
659
+ * import { Buffer } from 'node:buffer';
660
660
  *
661
661
  * const buf1 = Buffer.from('ABC');
662
662
  * const buf2 = Buffer.from('414243', 'hex');
@@ -680,7 +680,7 @@ declare module "buffer" {
680
680
  * * `-1` is returned if `target` should come _after_`buf` when sorted.
681
681
  *
682
682
  * ```js
683
- * import { Buffer } from 'buffer';
683
+ * import { Buffer } from 'node:buffer';
684
684
  *
685
685
  * const buf1 = Buffer.from('ABC');
686
686
  * const buf2 = Buffer.from('BCD');
@@ -704,7 +704,7 @@ declare module "buffer" {
704
704
  * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively.
705
705
  *
706
706
  * ```js
707
- * import { Buffer } from 'buffer';
707
+ * import { Buffer } from 'node:buffer';
708
708
  *
709
709
  * const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);
710
710
  * const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);
@@ -731,7 +731,7 @@ declare module "buffer" {
731
731
  targetEnd?: number,
732
732
  sourceStart?: number,
733
733
  sourceEnd?: number,
734
- ): number;
734
+ ): -1 | 0 | 1;
735
735
  /**
736
736
  * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`.
737
737
  *
@@ -740,7 +740,7 @@ declare module "buffer" {
740
740
  * different function arguments.
741
741
  *
742
742
  * ```js
743
- * import { Buffer } from 'buffer';
743
+ * import { Buffer } from 'node:buffer';
744
744
  *
745
745
  * // Create two `Buffer` instances.
746
746
  * const buf1 = Buffer.allocUnsafe(26);
@@ -761,7 +761,7 @@ declare module "buffer" {
761
761
  * ```
762
762
  *
763
763
  * ```js
764
- * import { Buffer } from 'buffer';
764
+ * import { Buffer } from 'node:buffer';
765
765
  *
766
766
  * // Create a `Buffer` and copy data from one region to an overlapping region
767
767
  * // within the same `Buffer`.
@@ -790,13 +790,11 @@ declare module "buffer" {
790
790
  * Returns a new `Buffer` that references the same memory as the original, but
791
791
  * offset and cropped by the `start` and `end` indices.
792
792
  *
793
- * This is the same behavior as `buf.subarray()`.
794
- *
795
793
  * This method is not compatible with the `Uint8Array.prototype.slice()`,
796
794
  * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
797
795
  *
798
796
  * ```js
799
- * import { Buffer } from 'buffer';
797
+ * import { Buffer } from 'node:buffer';
800
798
  *
801
799
  * const buf = Buffer.from('buffer');
802
800
  *
@@ -807,8 +805,17 @@ declare module "buffer" {
807
805
  *
808
806
  * console.log(buf.toString());
809
807
  * // Prints: buffer
808
+ *
809
+ * // With buf.slice(), the original buffer is modified.
810
+ * const notReallyCopiedBuf = buf.slice();
811
+ * notReallyCopiedBuf[0]++;
812
+ * console.log(notReallyCopiedBuf.toString());
813
+ * // Prints: cuffer
814
+ * console.log(buf.toString());
815
+ * // Also prints: cuffer (!)
810
816
  * ```
811
817
  * @since v0.3.0
818
+ * @deprecated Use `subarray` instead.
812
819
  * @param [start=0] Where the new `Buffer` will start.
813
820
  * @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
814
821
  */
@@ -825,7 +832,7 @@ declare module "buffer" {
825
832
  * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
826
833
  *
827
834
  * ```js
828
- * import { Buffer } from 'buffer';
835
+ * import { Buffer } from 'node:buffer';
829
836
  *
830
837
  * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
831
838
  * // from the original `Buffer`.
@@ -852,7 +859,7 @@ declare module "buffer" {
852
859
  * end of `buf` rather than the beginning.
853
860
  *
854
861
  * ```js
855
- * import { Buffer } from 'buffer';
862
+ * import { Buffer } from 'node:buffer';
856
863
  *
857
864
  * const buf = Buffer.from('buffer');
858
865
  *
@@ -879,7 +886,7 @@ declare module "buffer" {
879
886
  * `value` is interpreted and written as a two's complement signed integer.
880
887
  *
881
888
  * ```js
882
- * import { Buffer } from 'buffer';
889
+ * import { Buffer } from 'node:buffer';
883
890
  *
884
891
  * const buf = Buffer.allocUnsafe(8);
885
892
  *
@@ -900,7 +907,7 @@ declare module "buffer" {
900
907
  * `value` is interpreted and written as a two's complement signed integer.
901
908
  *
902
909
  * ```js
903
- * import { Buffer } from 'buffer';
910
+ * import { Buffer } from 'node:buffer';
904
911
  *
905
912
  * const buf = Buffer.allocUnsafe(8);
906
913
  *
@@ -921,7 +928,7 @@ declare module "buffer" {
921
928
  * This function is also available under the `writeBigUint64BE` alias.
922
929
  *
923
930
  * ```js
924
- * import { Buffer } from 'buffer';
931
+ * import { Buffer } from 'node:buffer';
925
932
  *
926
933
  * const buf = Buffer.allocUnsafe(8);
927
934
  *
@@ -945,7 +952,7 @@ declare module "buffer" {
945
952
  * Writes `value` to `buf` at the specified `offset` as little-endian
946
953
  *
947
954
  * ```js
948
- * import { Buffer } from 'buffer';
955
+ * import { Buffer } from 'node:buffer';
949
956
  *
950
957
  * const buf = Buffer.allocUnsafe(8);
951
958
  *
@@ -974,7 +981,7 @@ declare module "buffer" {
974
981
  * This function is also available under the `writeUintLE` alias.
975
982
  *
976
983
  * ```js
977
- * import { Buffer } from 'buffer';
984
+ * import { Buffer } from 'node:buffer';
978
985
  *
979
986
  * const buf = Buffer.allocUnsafe(6);
980
987
  *
@@ -1002,7 +1009,7 @@ declare module "buffer" {
1002
1009
  * This function is also available under the `writeUintBE` alias.
1003
1010
  *
1004
1011
  * ```js
1005
- * import { Buffer } from 'buffer';
1012
+ * import { Buffer } from 'node:buffer';
1006
1013
  *
1007
1014
  * const buf = Buffer.allocUnsafe(6);
1008
1015
  *
@@ -1028,7 +1035,7 @@ declare module "buffer" {
1028
1035
  * when `value` is anything other than a signed integer.
1029
1036
  *
1030
1037
  * ```js
1031
- * import { Buffer } from 'buffer';
1038
+ * import { Buffer } from 'node:buffer';
1032
1039
  *
1033
1040
  * const buf = Buffer.allocUnsafe(6);
1034
1041
  *
@@ -1049,7 +1056,7 @@ declare module "buffer" {
1049
1056
  * signed integer.
1050
1057
  *
1051
1058
  * ```js
1052
- * import { Buffer } from 'buffer';
1059
+ * import { Buffer } from 'node:buffer';
1053
1060
  *
1054
1061
  * const buf = Buffer.allocUnsafe(6);
1055
1062
  *
@@ -1071,7 +1078,7 @@ declare module "buffer" {
1071
1078
  * This function is also available under the `readBigUint64BE` alias.
1072
1079
  *
1073
1080
  * ```js
1074
- * import { Buffer } from 'buffer';
1081
+ * import { Buffer } from 'node:buffer';
1075
1082
  *
1076
1083
  * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
1077
1084
  *
@@ -1093,7 +1100,7 @@ declare module "buffer" {
1093
1100
  * This function is also available under the `readBigUint64LE` alias.
1094
1101
  *
1095
1102
  * ```js
1096
- * import { Buffer } from 'buffer';
1103
+ * import { Buffer } from 'node:buffer';
1097
1104
  *
1098
1105
  * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
1099
1106
  *
@@ -1134,7 +1141,7 @@ declare module "buffer" {
1134
1141
  * This function is also available under the `readUintLE` alias.
1135
1142
  *
1136
1143
  * ```js
1137
- * import { Buffer } from 'buffer';
1144
+ * import { Buffer } from 'node:buffer';
1138
1145
  *
1139
1146
  * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1140
1147
  *
@@ -1158,7 +1165,7 @@ declare module "buffer" {
1158
1165
  * This function is also available under the `readUintBE` alias.
1159
1166
  *
1160
1167
  * ```js
1161
- * import { Buffer } from 'buffer';
1168
+ * import { Buffer } from 'node:buffer';
1162
1169
  *
1163
1170
  * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1164
1171
  *
@@ -1182,7 +1189,7 @@ declare module "buffer" {
1182
1189
  * supporting up to 48 bits of accuracy.
1183
1190
  *
1184
1191
  * ```js
1185
- * import { Buffer } from 'buffer';
1192
+ * import { Buffer } from 'node:buffer';
1186
1193
  *
1187
1194
  * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1188
1195
  *
@@ -1199,7 +1206,7 @@ declare module "buffer" {
1199
1206
  * supporting up to 48 bits of accuracy.
1200
1207
  *
1201
1208
  * ```js
1202
- * import { Buffer } from 'buffer';
1209
+ * import { Buffer } from 'node:buffer';
1203
1210
  *
1204
1211
  * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
1205
1212
  *
@@ -1221,7 +1228,7 @@ declare module "buffer" {
1221
1228
  * This function is also available under the `readUint8` alias.
1222
1229
  *
1223
1230
  * ```js
1224
- * import { Buffer } from 'buffer';
1231
+ * import { Buffer } from 'node:buffer';
1225
1232
  *
1226
1233
  * const buf = Buffer.from([1, -2]);
1227
1234
  *
@@ -1247,7 +1254,7 @@ declare module "buffer" {
1247
1254
  * This function is also available under the `readUint16LE` alias.
1248
1255
  *
1249
1256
  * ```js
1250
- * import { Buffer } from 'buffer';
1257
+ * import { Buffer } from 'node:buffer';
1251
1258
  *
1252
1259
  * const buf = Buffer.from([0x12, 0x34, 0x56]);
1253
1260
  *
@@ -1273,7 +1280,7 @@ declare module "buffer" {
1273
1280
  * This function is also available under the `readUint16BE` alias.
1274
1281
  *
1275
1282
  * ```js
1276
- * import { Buffer } from 'buffer';
1283
+ * import { Buffer } from 'node:buffer';
1277
1284
  *
1278
1285
  * const buf = Buffer.from([0x12, 0x34, 0x56]);
1279
1286
  *
@@ -1297,7 +1304,7 @@ declare module "buffer" {
1297
1304
  * This function is also available under the `readUint32LE` alias.
1298
1305
  *
1299
1306
  * ```js
1300
- * import { Buffer } from 'buffer';
1307
+ * import { Buffer } from 'node:buffer';
1301
1308
  *
1302
1309
  * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
1303
1310
  *
@@ -1321,7 +1328,7 @@ declare module "buffer" {
1321
1328
  * This function is also available under the `readUint32BE` alias.
1322
1329
  *
1323
1330
  * ```js
1324
- * import { Buffer } from 'buffer';
1331
+ * import { Buffer } from 'node:buffer';
1325
1332
  *
1326
1333
  * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
1327
1334
  *
@@ -1343,7 +1350,7 @@ declare module "buffer" {
1343
1350
  * Integers read from a `Buffer` are interpreted as two's complement signed values.
1344
1351
  *
1345
1352
  * ```js
1346
- * import { Buffer } from 'buffer';
1353
+ * import { Buffer } from 'node:buffer';
1347
1354
  *
1348
1355
  * const buf = Buffer.from([-1, 5]);
1349
1356
  *
@@ -1364,7 +1371,7 @@ declare module "buffer" {
1364
1371
  * Integers read from a `Buffer` are interpreted as two's complement signed values.
1365
1372
  *
1366
1373
  * ```js
1367
- * import { Buffer } from 'buffer';
1374
+ * import { Buffer } from 'node:buffer';
1368
1375
  *
1369
1376
  * const buf = Buffer.from([0, 5]);
1370
1377
  *
@@ -1383,7 +1390,7 @@ declare module "buffer" {
1383
1390
  * Integers read from a `Buffer` are interpreted as two's complement signed values.
1384
1391
  *
1385
1392
  * ```js
1386
- * import { Buffer } from 'buffer';
1393
+ * import { Buffer } from 'node:buffer';
1387
1394
  *
1388
1395
  * const buf = Buffer.from([0, 5]);
1389
1396
  *
@@ -1400,7 +1407,7 @@ declare module "buffer" {
1400
1407
  * Integers read from a `Buffer` are interpreted as two's complement signed values.
1401
1408
  *
1402
1409
  * ```js
1403
- * import { Buffer } from 'buffer';
1410
+ * import { Buffer } from 'node:buffer';
1404
1411
  *
1405
1412
  * const buf = Buffer.from([0, 0, 0, 5]);
1406
1413
  *
@@ -1419,7 +1426,7 @@ declare module "buffer" {
1419
1426
  * Integers read from a `Buffer` are interpreted as two's complement signed values.
1420
1427
  *
1421
1428
  * ```js
1422
- * import { Buffer } from 'buffer';
1429
+ * import { Buffer } from 'node:buffer';
1423
1430
  *
1424
1431
  * const buf = Buffer.from([0, 0, 0, 5]);
1425
1432
  *
@@ -1434,7 +1441,7 @@ declare module "buffer" {
1434
1441
  * Reads a 32-bit, little-endian float from `buf` at the specified `offset`.
1435
1442
  *
1436
1443
  * ```js
1437
- * import { Buffer } from 'buffer';
1444
+ * import { Buffer } from 'node:buffer';
1438
1445
  *
1439
1446
  * const buf = Buffer.from([1, 2, 3, 4]);
1440
1447
  *
@@ -1451,7 +1458,7 @@ declare module "buffer" {
1451
1458
  * Reads a 32-bit, big-endian float from `buf` at the specified `offset`.
1452
1459
  *
1453
1460
  * ```js
1454
- * import { Buffer } from 'buffer';
1461
+ * import { Buffer } from 'node:buffer';
1455
1462
  *
1456
1463
  * const buf = Buffer.from([1, 2, 3, 4]);
1457
1464
  *
@@ -1466,7 +1473,7 @@ declare module "buffer" {
1466
1473
  * Reads a 64-bit, little-endian double from `buf` at the specified `offset`.
1467
1474
  *
1468
1475
  * ```js
1469
- * import { Buffer } from 'buffer';
1476
+ * import { Buffer } from 'node:buffer';
1470
1477
  *
1471
1478
  * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
1472
1479
  *
@@ -1483,7 +1490,7 @@ declare module "buffer" {
1483
1490
  * Reads a 64-bit, big-endian double from `buf` at the specified `offset`.
1484
1491
  *
1485
1492
  * ```js
1486
- * import { Buffer } from 'buffer';
1493
+ * import { Buffer } from 'node:buffer';
1487
1494
  *
1488
1495
  * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
1489
1496
  *
@@ -1500,7 +1507,7 @@ declare module "buffer" {
1500
1507
  * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2.
1501
1508
  *
1502
1509
  * ```js
1503
- * import { Buffer } from 'buffer';
1510
+ * import { Buffer } from 'node:buffer';
1504
1511
  *
1505
1512
  * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
1506
1513
  *
@@ -1522,7 +1529,7 @@ declare module "buffer" {
1522
1529
  * between UTF-16 little-endian and UTF-16 big-endian:
1523
1530
  *
1524
1531
  * ```js
1525
- * import { Buffer } from 'buffer';
1532
+ * import { Buffer } from 'node:buffer';
1526
1533
  *
1527
1534
  * const buf = Buffer.from('This is little-endian UTF-16', 'utf16le');
1528
1535
  * buf.swap16(); // Convert to big-endian UTF-16 text.
@@ -1536,7 +1543,7 @@ declare module "buffer" {
1536
1543
  * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
1537
1544
  *
1538
1545
  * ```js
1539
- * import { Buffer } from 'buffer';
1546
+ * import { Buffer } from 'node:buffer';
1540
1547
  *
1541
1548
  * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
1542
1549
  *
@@ -1562,7 +1569,7 @@ declare module "buffer" {
1562
1569
  * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
1563
1570
  *
1564
1571
  * ```js
1565
- * import { Buffer } from 'buffer';
1572
+ * import { Buffer } from 'node:buffer';
1566
1573
  *
1567
1574
  * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
1568
1575
  *
@@ -1591,7 +1598,7 @@ declare module "buffer" {
1591
1598
  * This function is also available under the `writeUint8` alias.
1592
1599
  *
1593
1600
  * ```js
1594
- * import { Buffer } from 'buffer';
1601
+ * import { Buffer } from 'node:buffer';
1595
1602
  *
1596
1603
  * const buf = Buffer.allocUnsafe(4);
1597
1604
  *
@@ -1621,7 +1628,7 @@ declare module "buffer" {
1621
1628
  * This function is also available under the `writeUint16LE` alias.
1622
1629
  *
1623
1630
  * ```js
1624
- * import { Buffer } from 'buffer';
1631
+ * import { Buffer } from 'node:buffer';
1625
1632
  *
1626
1633
  * const buf = Buffer.allocUnsafe(4);
1627
1634
  *
@@ -1649,7 +1656,7 @@ declare module "buffer" {
1649
1656
  * This function is also available under the `writeUint16BE` alias.
1650
1657
  *
1651
1658
  * ```js
1652
- * import { Buffer } from 'buffer';
1659
+ * import { Buffer } from 'node:buffer';
1653
1660
  *
1654
1661
  * const buf = Buffer.allocUnsafe(4);
1655
1662
  *
@@ -1677,7 +1684,7 @@ declare module "buffer" {
1677
1684
  * This function is also available under the `writeUint32LE` alias.
1678
1685
  *
1679
1686
  * ```js
1680
- * import { Buffer } from 'buffer';
1687
+ * import { Buffer } from 'node:buffer';
1681
1688
  *
1682
1689
  * const buf = Buffer.allocUnsafe(4);
1683
1690
  *
@@ -1704,7 +1711,7 @@ declare module "buffer" {
1704
1711
  * This function is also available under the `writeUint32BE` alias.
1705
1712
  *
1706
1713
  * ```js
1707
- * import { Buffer } from 'buffer';
1714
+ * import { Buffer } from 'node:buffer';
1708
1715
  *
1709
1716
  * const buf = Buffer.allocUnsafe(4);
1710
1717
  *
@@ -1732,7 +1739,7 @@ declare module "buffer" {
1732
1739
  * `value` is interpreted and written as a two's complement signed integer.
1733
1740
  *
1734
1741
  * ```js
1735
- * import { Buffer } from 'buffer';
1742
+ * import { Buffer } from 'node:buffer';
1736
1743
  *
1737
1744
  * const buf = Buffer.allocUnsafe(2);
1738
1745
  *
@@ -1755,7 +1762,7 @@ declare module "buffer" {
1755
1762
  * The `value` is interpreted and written as a two's complement signed integer.
1756
1763
  *
1757
1764
  * ```js
1758
- * import { Buffer } from 'buffer';
1765
+ * import { Buffer } from 'node:buffer';
1759
1766
  *
1760
1767
  * const buf = Buffer.allocUnsafe(2);
1761
1768
  *
@@ -1777,7 +1784,7 @@ declare module "buffer" {
1777
1784
  * The `value` is interpreted and written as a two's complement signed integer.
1778
1785
  *
1779
1786
  * ```js
1780
- * import { Buffer } from 'buffer';
1787
+ * import { Buffer } from 'node:buffer';
1781
1788
  *
1782
1789
  * const buf = Buffer.allocUnsafe(2);
1783
1790
  *
@@ -1799,7 +1806,7 @@ declare module "buffer" {
1799
1806
  * The `value` is interpreted and written as a two's complement signed integer.
1800
1807
  *
1801
1808
  * ```js
1802
- * import { Buffer } from 'buffer';
1809
+ * import { Buffer } from 'node:buffer';
1803
1810
  *
1804
1811
  * const buf = Buffer.allocUnsafe(4);
1805
1812
  *
@@ -1821,7 +1828,7 @@ declare module "buffer" {
1821
1828
  * The `value` is interpreted and written as a two's complement signed integer.
1822
1829
  *
1823
1830
  * ```js
1824
- * import { Buffer } from 'buffer';
1831
+ * import { Buffer } from 'node:buffer';
1825
1832
  *
1826
1833
  * const buf = Buffer.allocUnsafe(4);
1827
1834
  *
@@ -1841,7 +1848,7 @@ declare module "buffer" {
1841
1848
  * undefined when `value` is anything other than a JavaScript number.
1842
1849
  *
1843
1850
  * ```js
1844
- * import { Buffer } from 'buffer';
1851
+ * import { Buffer } from 'node:buffer';
1845
1852
  *
1846
1853
  * const buf = Buffer.allocUnsafe(4);
1847
1854
  *
@@ -1861,7 +1868,7 @@ declare module "buffer" {
1861
1868
  * undefined when `value` is anything other than a JavaScript number.
1862
1869
  *
1863
1870
  * ```js
1864
- * import { Buffer } from 'buffer';
1871
+ * import { Buffer } from 'node:buffer';
1865
1872
  *
1866
1873
  * const buf = Buffer.allocUnsafe(4);
1867
1874
  *
@@ -1881,7 +1888,7 @@ declare module "buffer" {
1881
1888
  * other than a JavaScript number.
1882
1889
  *
1883
1890
  * ```js
1884
- * import { Buffer } from 'buffer';
1891
+ * import { Buffer } from 'node:buffer';
1885
1892
  *
1886
1893
  * const buf = Buffer.allocUnsafe(8);
1887
1894
  *
@@ -1901,7 +1908,7 @@ declare module "buffer" {
1901
1908
  * other than a JavaScript number.
1902
1909
  *
1903
1910
  * ```js
1904
- * import { Buffer } from 'buffer';
1911
+ * import { Buffer } from 'node:buffer';
1905
1912
  *
1906
1913
  * const buf = Buffer.allocUnsafe(8);
1907
1914
  *
@@ -1921,7 +1928,7 @@ declare module "buffer" {
1921
1928
  * the entire `buf` will be filled:
1922
1929
  *
1923
1930
  * ```js
1924
- * import { Buffer } from 'buffer';
1931
+ * import { Buffer } from 'node:buffer';
1925
1932
  *
1926
1933
  * // Fill a `Buffer` with the ASCII character 'h'.
1927
1934
  *
@@ -1939,7 +1946,7 @@ declare module "buffer" {
1939
1946
  * then only the bytes of that character that fit into `buf` are written:
1940
1947
  *
1941
1948
  * ```js
1942
- * import { Buffer } from 'buffer';
1949
+ * import { Buffer } from 'node:buffer';
1943
1950
  *
1944
1951
  * // Fill a `Buffer` with character that takes up two bytes in UTF-8.
1945
1952
  *
@@ -1951,7 +1958,7 @@ declare module "buffer" {
1951
1958
  * fill data remains, an exception is thrown:
1952
1959
  *
1953
1960
  * ```js
1954
- * import { Buffer } from 'buffer';
1961
+ * import { Buffer } from 'node:buffer';
1955
1962
  *
1956
1963
  * const buf = Buffer.allocUnsafe(5);
1957
1964
  *
@@ -1975,12 +1982,12 @@ declare module "buffer" {
1975
1982
  *
1976
1983
  * * a string, `value` is interpreted according to the character encoding in`encoding`.
1977
1984
  * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
1978
- * To compare a partial `Buffer`, use `buf.slice()`.
1985
+ * To compare a partial `Buffer`, use `buf.subarray`.
1979
1986
  * * a number, `value` will be interpreted as an unsigned 8-bit integer
1980
1987
  * value between `0` and `255`.
1981
1988
  *
1982
1989
  * ```js
1983
- * import { Buffer } from 'buffer';
1990
+ * import { Buffer } from 'node:buffer';
1984
1991
  *
1985
1992
  * const buf = Buffer.from('this is a buffer');
1986
1993
  *
@@ -2013,7 +2020,7 @@ declare module "buffer" {
2013
2020
  * behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf).
2014
2021
  *
2015
2022
  * ```js
2016
- * import { Buffer } from 'buffer';
2023
+ * import { Buffer } from 'node:buffer';
2017
2024
  *
2018
2025
  * const b = Buffer.from('abcdef');
2019
2026
  *
@@ -2044,7 +2051,7 @@ declare module "buffer" {
2044
2051
  * rather than the first occurrence.
2045
2052
  *
2046
2053
  * ```js
2047
- * import { Buffer } from 'buffer';
2054
+ * import { Buffer } from 'node:buffer';
2048
2055
  *
2049
2056
  * const buf = Buffer.from('this buffer is a buffer');
2050
2057
  *
@@ -2079,7 +2086,7 @@ declare module "buffer" {
2079
2086
  * This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf).
2080
2087
  *
2081
2088
  * ```js
2082
- * import { Buffer } from 'buffer';
2089
+ * import { Buffer } from 'node:buffer';
2083
2090
  *
2084
2091
  * const b = Buffer.from('abcdef');
2085
2092
  *
@@ -2112,7 +2119,7 @@ declare module "buffer" {
2112
2119
  * of `buf`.
2113
2120
  *
2114
2121
  * ```js
2115
- * import { Buffer } from 'buffer';
2122
+ * import { Buffer } from 'node:buffer';
2116
2123
  *
2117
2124
  * // Log the entire contents of a `Buffer`.
2118
2125
  *
@@ -2136,7 +2143,7 @@ declare module "buffer" {
2136
2143
  * Equivalent to `buf.indexOf() !== -1`.
2137
2144
  *
2138
2145
  * ```js
2139
- * import { Buffer } from 'buffer';
2146
+ * import { Buffer } from 'node:buffer';
2140
2147
  *
2141
2148
  * const buf = Buffer.from('this is a buffer');
2142
2149
  *
@@ -2166,7 +2173,7 @@ declare module "buffer" {
2166
2173
  * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `buf` keys (indices).
2167
2174
  *
2168
2175
  * ```js
2169
- * import { Buffer } from 'buffer';
2176
+ * import { Buffer } from 'node:buffer';
2170
2177
  *
2171
2178
  * const buf = Buffer.from('buffer');
2172
2179
  *
@@ -2189,7 +2196,7 @@ declare module "buffer" {
2189
2196
  * called automatically when a `Buffer` is used in a `for..of` statement.
2190
2197
  *
2191
2198
  * ```js
2192
- * import { Buffer } from 'buffer';
2199
+ * import { Buffer } from 'node:buffer';
2193
2200
  *
2194
2201
  * const buf = Buffer.from('buffer');
2195
2202
  *
@@ -2231,7 +2238,7 @@ declare module "buffer" {
2231
2238
  * **binary data and predate the introduction of typed arrays in JavaScript.**
2232
2239
  * **For code running using Node.js APIs, converting between base64-encoded strings**
2233
2240
  * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
2234
- * @since v15.13.0
2241
+ * @since v15.13.0, v14.17.0
2235
2242
  * @legacy Use `Buffer.from(data, 'base64')` instead.
2236
2243
  * @param data The Base64-encoded input string.
2237
2244
  */
@@ -2247,7 +2254,7 @@ declare module "buffer" {
2247
2254
  * **binary data and predate the introduction of typed arrays in JavaScript.**
2248
2255
  * **For code running using Node.js APIs, converting between base64-encoded strings**
2249
2256
  * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
2250
- * @since v15.13.0
2257
+ * @since v15.13.0, v14.17.0
2251
2258
  * @legacy Use `buf.toString('base64')` instead.
2252
2259
  * @param data An ASCII (Latin1) string.
2253
2260
  */