cdk-common 1.0.1186 → 1.0.1188

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.
Files changed (68) hide show
  1. package/.jsii +36 -6
  2. package/API.md +30 -0
  3. package/lib/main.js +1 -1
  4. package/lib/managed-policies.d.ts +1351 -1346
  5. package/lib/managed-policies.js +6 -1
  6. package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
  7. package/node_modules/@types/concat-stream/node_modules/@types/node/async_hooks.d.ts +64 -0
  8. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.buffer.d.ts +2 -0
  9. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +2 -2
  10. package/node_modules/@types/concat-stream/node_modules/@types/node/cluster.d.ts +1 -1
  11. package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +20 -1
  12. package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +18 -15
  13. package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +93 -9
  14. package/node_modules/@types/concat-stream/node_modules/@types/node/globals.d.ts +140 -280
  15. package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +22 -1
  16. package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +14 -8
  17. package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
  18. package/node_modules/@types/concat-stream/node_modules/@types/node/querystring.d.ts +2 -3
  19. package/node_modules/@types/concat-stream/node_modules/@types/node/stream/web.d.ts +3 -3
  20. package/node_modules/@types/concat-stream/node_modules/@types/node/tls.d.ts +1 -1
  21. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +2 -0
  22. package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +13 -0
  23. package/node_modules/@types/concat-stream/node_modules/@types/node/vm.d.ts +20 -5
  24. package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
  25. package/node_modules/@types/form-data/node_modules/@types/node/async_hooks.d.ts +64 -0
  26. package/node_modules/@types/form-data/node_modules/@types/node/buffer.buffer.d.ts +2 -0
  27. package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +2 -2
  28. package/node_modules/@types/form-data/node_modules/@types/node/cluster.d.ts +1 -1
  29. package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +20 -1
  30. package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +18 -15
  31. package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +93 -9
  32. package/node_modules/@types/form-data/node_modules/@types/node/globals.d.ts +140 -280
  33. package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +22 -1
  34. package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +14 -8
  35. package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
  36. package/node_modules/@types/form-data/node_modules/@types/node/querystring.d.ts +2 -3
  37. package/node_modules/@types/form-data/node_modules/@types/node/stream/web.d.ts +3 -3
  38. package/node_modules/@types/form-data/node_modules/@types/node/tls.d.ts +1 -1
  39. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +2 -0
  40. package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +13 -0
  41. package/node_modules/@types/form-data/node_modules/@types/node/vm.d.ts +20 -5
  42. package/node_modules/@types/qs/README.md +1 -1
  43. package/node_modules/@types/qs/index.d.ts +1 -0
  44. package/node_modules/@types/qs/package.json +3 -3
  45. package/node_modules/{readable-stream → form-data}/node_modules/safe-buffer/index.js +3 -0
  46. package/node_modules/{string_decoder → form-data}/node_modules/safe-buffer/package.json +18 -4
  47. package/node_modules/safe-buffer/index.js +0 -3
  48. package/node_modules/safe-buffer/package.json +4 -18
  49. package/package.json +10 -10
  50. package/node_modules/readable-stream/node_modules/safe-buffer/package.json +0 -37
  51. package/node_modules/string_decoder/node_modules/safe-buffer/LICENSE +0 -21
  52. package/node_modules/string_decoder/node_modules/safe-buffer/README.md +0 -584
  53. package/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts +0 -187
  54. package/node_modules/string_decoder/node_modules/safe-buffer/index.js +0 -62
  55. /package/node_modules/{readable-stream → form-data}/node_modules/safe-buffer/LICENSE +0 -0
  56. /package/node_modules/{readable-stream → form-data}/node_modules/safe-buffer/README.md +0 -0
  57. /package/node_modules/{readable-stream → form-data}/node_modules/safe-buffer/index.d.ts +0 -0
  58. /package/node_modules/{form-data/node_modules/mime-db → mime-db}/HISTORY.md +0 -0
  59. /package/node_modules/{form-data/node_modules/mime-db → mime-db}/LICENSE +0 -0
  60. /package/node_modules/{form-data/node_modules/mime-db → mime-db}/README.md +0 -0
  61. /package/node_modules/{form-data/node_modules/mime-db → mime-db}/db.json +0 -0
  62. /package/node_modules/{form-data/node_modules/mime-db → mime-db}/index.js +0 -0
  63. /package/node_modules/{form-data/node_modules/mime-db → mime-db}/package.json +0 -0
  64. /package/node_modules/{form-data/node_modules/mime-types → mime-types}/HISTORY.md +0 -0
  65. /package/node_modules/{form-data/node_modules/mime-types → mime-types}/LICENSE +0 -0
  66. /package/node_modules/{form-data/node_modules/mime-types → mime-types}/README.md +0 -0
  67. /package/node_modules/{form-data/node_modules/mime-types → mime-types}/index.js +0 -0
  68. /package/node_modules/{form-data/node_modules/mime-types → mime-types}/package.json +0 -0
@@ -647,7 +647,7 @@ declare module "tls" {
647
647
  * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created
648
648
  * with {@link createSecureContext} itself.
649
649
  */
650
- addContext(hostname: string, context: SecureContextOptions): void;
650
+ addContext(hostname: string, context: SecureContextOptions | SecureContext): void;
651
651
  /**
652
652
  * Returns the session ticket keys.
653
653
  *
@@ -448,6 +448,8 @@ declare module "buffer" {
448
448
  */
449
449
  subarray(start?: number, end?: number): Buffer;
450
450
  }
451
+ type NonSharedBuffer = Buffer;
452
+ type AllowSharedBuffer = Buffer;
451
453
  }
452
454
  /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
453
455
  var SlowBuffer: {
@@ -1466,6 +1466,18 @@ declare module "util" {
1466
1466
  | "reset"
1467
1467
  | "strikethrough"
1468
1468
  | "underline";
1469
+ export interface StyleTextOptions {
1470
+ /**
1471
+ * When true, `stream` is checked to see if it can handle colors.
1472
+ * @default true
1473
+ */
1474
+ validateStream?: boolean | undefined;
1475
+ /**
1476
+ * A stream that will be validated if it can be colored.
1477
+ * @default process.stdout
1478
+ */
1479
+ stream?: NodeJS.WritableStream | undefined;
1480
+ }
1469
1481
  /**
1470
1482
  * This function returns a formatted text considering the `format` passed
1471
1483
  * for printing in a terminal. It is aware of the terminal's capabilities
@@ -1518,6 +1530,7 @@ declare module "util" {
1518
1530
  | Modifiers
1519
1531
  | Array<ForegroundColors | BackgroundColors | Modifiers>,
1520
1532
  text: string,
1533
+ options?: StyleTextOptions,
1521
1534
  ): string;
1522
1535
  /**
1523
1536
  * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API.
@@ -58,7 +58,7 @@ declare module "vm" {
58
58
  }
59
59
  interface ScriptOptions extends BaseOptions {
60
60
  /**
61
- * V8's code cache data for the supplied source.
61
+ * Provides an optional data with V8's code cache data for the supplied source.
62
62
  */
63
63
  cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
64
64
  /** @deprecated in favor of `script.createCachedData()` */
@@ -110,18 +110,24 @@ declare module "vm" {
110
110
  microtaskMode?: CreateContextOptions["microtaskMode"];
111
111
  }
112
112
  interface RunningCodeOptions extends RunningScriptOptions {
113
- cachedData?: ScriptOptions["cachedData"];
113
+ /**
114
+ * Provides an optional data with V8's code cache data for the supplied source.
115
+ */
116
+ cachedData?: ScriptOptions["cachedData"] | undefined;
114
117
  importModuleDynamically?: ScriptOptions["importModuleDynamically"];
115
118
  }
116
119
  interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions {
117
- cachedData?: ScriptOptions["cachedData"];
120
+ /**
121
+ * Provides an optional data with V8's code cache data for the supplied source.
122
+ */
123
+ cachedData?: ScriptOptions["cachedData"] | undefined;
118
124
  importModuleDynamically?: ScriptOptions["importModuleDynamically"];
119
125
  }
120
126
  interface CompileFunctionOptions extends BaseOptions {
121
127
  /**
122
128
  * Provides an optional data with V8's code cache data for the supplied source.
123
129
  */
124
- cachedData?: Buffer | undefined;
130
+ cachedData?: ScriptOptions["cachedData"] | undefined;
125
131
  /**
126
132
  * Specifies whether to produce new cache data.
127
133
  * @default false
@@ -848,6 +854,9 @@ declare module "vm" {
848
854
  * @default 'vm:module(i)' where i is a context-specific ascending index.
849
855
  */
850
856
  identifier?: string | undefined;
857
+ /**
858
+ * Provides an optional data with V8's code cache data for the supplied source.
859
+ */
851
860
  cachedData?: ScriptOptions["cachedData"] | undefined;
852
861
  context?: Context | undefined;
853
862
  lineOffset?: BaseOptions["lineOffset"] | undefined;
@@ -856,7 +865,13 @@ declare module "vm" {
856
865
  * Called during evaluation of this module to initialize the `import.meta`.
857
866
  */
858
867
  initializeImportMeta?: ((meta: ImportMeta, module: SourceTextModule) => void) | undefined;
859
- importModuleDynamically?: ScriptOptions["importModuleDynamically"] | undefined;
868
+ importModuleDynamically?:
869
+ | ((
870
+ specifier: string,
871
+ referrer: SourceTextModule,
872
+ importAttributes: ImportAttributes,
873
+ ) => Module | Promise<Module>)
874
+ | undefined;
860
875
  }
861
876
  /**
862
877
  * This feature is only available with the `--experimental-vm-modules` command
@@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Mon, 28 Apr 2025 06:43:21 GMT
11
+ * Last updated: Wed, 14 May 2025 04:37:31 GMT
12
12
  * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
13
13
 
14
14
  # Credits
@@ -533,6 +533,70 @@ declare module "async_hooks" {
533
533
  */
534
534
  enterWith(store: T): void;
535
535
  }
536
+ /**
537
+ * @since v17.2.0, v16.14.0
538
+ * @return A map of provider types to the corresponding numeric id.
539
+ * This map contains all the event types that might be emitted by the `async_hooks.init()` event.
540
+ */
541
+ namespace asyncWrapProviders {
542
+ const NONE: number;
543
+ const DIRHANDLE: number;
544
+ const DNSCHANNEL: number;
545
+ const ELDHISTOGRAM: number;
546
+ const FILEHANDLE: number;
547
+ const FILEHANDLECLOSEREQ: number;
548
+ const FIXEDSIZEBLOBCOPY: number;
549
+ const FSEVENTWRAP: number;
550
+ const FSREQCALLBACK: number;
551
+ const FSREQPROMISE: number;
552
+ const GETADDRINFOREQWRAP: number;
553
+ const GETNAMEINFOREQWRAP: number;
554
+ const HEAPSNAPSHOT: number;
555
+ const HTTP2SESSION: number;
556
+ const HTTP2STREAM: number;
557
+ const HTTP2PING: number;
558
+ const HTTP2SETTINGS: number;
559
+ const HTTPINCOMINGMESSAGE: number;
560
+ const HTTPCLIENTREQUEST: number;
561
+ const JSSTREAM: number;
562
+ const JSUDPWRAP: number;
563
+ const MESSAGEPORT: number;
564
+ const PIPECONNECTWRAP: number;
565
+ const PIPESERVERWRAP: number;
566
+ const PIPEWRAP: number;
567
+ const PROCESSWRAP: number;
568
+ const PROMISE: number;
569
+ const QUERYWRAP: number;
570
+ const SHUTDOWNWRAP: number;
571
+ const SIGNALWRAP: number;
572
+ const STATWATCHER: number;
573
+ const STREAMPIPE: number;
574
+ const TCPCONNECTWRAP: number;
575
+ const TCPSERVERWRAP: number;
576
+ const TCPWRAP: number;
577
+ const TTYWRAP: number;
578
+ const UDPSENDWRAP: number;
579
+ const UDPWRAP: number;
580
+ const SIGINTWATCHDOG: number;
581
+ const WORKER: number;
582
+ const WORKERHEAPSNAPSHOT: number;
583
+ const WRITEWRAP: number;
584
+ const ZLIB: number;
585
+ const CHECKPRIMEREQUEST: number;
586
+ const PBKDF2REQUEST: number;
587
+ const KEYPAIRGENREQUEST: number;
588
+ const KEYGENREQUEST: number;
589
+ const KEYEXPORTREQUEST: number;
590
+ const CIPHERREQUEST: number;
591
+ const DERIVEBITSREQUEST: number;
592
+ const HASHREQUEST: number;
593
+ const RANDOMBYTESREQUEST: number;
594
+ const RANDOMPRIMEREQUEST: number;
595
+ const SCRYPTREQUEST: number;
596
+ const SIGNREQUEST: number;
597
+ const TLSWRAP: number;
598
+ const VERIFYREQUEST: number;
599
+ }
536
600
  }
537
601
  declare module "node:async_hooks" {
538
602
  export * from "async_hooks";
@@ -451,6 +451,8 @@ declare module "buffer" {
451
451
  */
452
452
  subarray(start?: number, end?: number): Buffer<TArrayBuffer>;
453
453
  }
454
+ type NonSharedBuffer = Buffer<ArrayBuffer>;
455
+ type AllowSharedBuffer = Buffer<ArrayBufferLike>;
454
456
  }
455
457
  /** @deprecated Use `Buffer.allocUnsafeSlow()` instead. */
456
458
  var SlowBuffer: {
@@ -69,7 +69,7 @@ declare module "buffer" {
69
69
  * @param input The input to validate.
70
70
  */
71
71
  export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
72
- export const INSPECT_MAX_BYTES: number;
72
+ export let INSPECT_MAX_BYTES: number;
73
73
  export const kMaxLength: number;
74
74
  export const kStringMaxLength: number;
75
75
  export const constants: {
@@ -122,7 +122,7 @@ declare module "buffer" {
122
122
  * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`.
123
123
  */
124
124
  export function resolveObjectURL(id: string): Blob | undefined;
125
- export { Buffer };
125
+ export { type AllowSharedBuffer, Buffer, type NonSharedBuffer };
126
126
  /**
127
127
  * @experimental
128
128
  */
@@ -266,7 +266,7 @@ declare module "cluster" {
266
266
  * @since v0.7.7
267
267
  * @return A reference to `worker`.
268
268
  */
269
- disconnect(): void;
269
+ disconnect(): this;
270
270
  /**
271
271
  * This function returns `true` if the worker is connected to its primary via its
272
272
  * IPC channel, `false` otherwise. A worker is connected to its primary after it
@@ -259,7 +259,7 @@ declare module "diagnostics_channel" {
259
259
  * @param store The store to unbind from the channel.
260
260
  * @return `true` if the store was found, `false` otherwise.
261
261
  */
262
- unbindStore(store: any): void;
262
+ unbindStore(store: AsyncLocalStorage<StoreType>): boolean;
263
263
  /**
264
264
  * Applies the given data to any AsyncLocalStorage instances bound to the channel
265
265
  * for the duration of the given function, then publishes to the channel within
@@ -547,6 +547,25 @@ declare module "diagnostics_channel" {
547
547
  thisArg?: any,
548
548
  ...args: Parameters<Fn>
549
549
  ): void;
550
+ /**
551
+ * `true` if any of the individual channels has a subscriber, `false` if not.
552
+ *
553
+ * This is a helper method available on a {@link TracingChannel} instance to check
554
+ * if any of the [TracingChannel Channels](https://nodejs.org/api/diagnostics_channel.html#tracingchannel-channels) have subscribers.
555
+ * A `true` is returned if any of them have at least one subscriber, a `false` is returned otherwise.
556
+ *
557
+ * ```js
558
+ * const diagnostics_channel = require('node:diagnostics_channel');
559
+ *
560
+ * const channels = diagnostics_channel.tracingChannel('my-channel');
561
+ *
562
+ * if (channels.hasSubscribers) {
563
+ * // Do something
564
+ * }
565
+ * ```
566
+ * @since v22.0.0, v20.13.0
567
+ */
568
+ readonly hasSubscribers: boolean;
550
569
  }
551
570
  }
552
571
  declare module "node:diagnostics_channel" {
@@ -277,36 +277,26 @@ declare module "fs/promises" {
277
277
  * data will be a string.
278
278
  */
279
279
  readFile(
280
- options?: {
281
- encoding?: null | undefined;
282
- flag?: OpenMode | undefined;
283
- } | null,
280
+ options?:
281
+ | ({ encoding?: null | undefined } & Abortable)
282
+ | null,
284
283
  ): Promise<Buffer>;
285
284
  /**
286
285
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
287
286
  * The `FileHandle` must have been opened for reading.
288
- * @param options An object that may contain an optional flag.
289
- * If a flag is not provided, it defaults to `'r'`.
290
287
  */
291
288
  readFile(
292
289
  options:
293
- | {
294
- encoding: BufferEncoding;
295
- flag?: OpenMode | undefined;
296
- }
290
+ | ({ encoding: BufferEncoding } & Abortable)
297
291
  | BufferEncoding,
298
292
  ): Promise<string>;
299
293
  /**
300
294
  * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
301
295
  * The `FileHandle` must have been opened for reading.
302
- * @param options An object that may contain an optional flag.
303
- * If a flag is not provided, it defaults to `'r'`.
304
296
  */
305
297
  readFile(
306
298
  options?:
307
- | (ObjectEncodingOptions & {
308
- flag?: OpenMode | undefined;
309
- })
299
+ | (ObjectEncodingOptions & Abortable)
310
300
  | BufferEncoding
311
301
  | null,
312
302
  ): Promise<string | Buffer>;
@@ -728,6 +718,19 @@ declare module "fs/promises" {
728
718
  recursive?: boolean | undefined;
729
719
  },
730
720
  ): Promise<Dirent[]>;
721
+ /**
722
+ * Asynchronous readdir(3) - read a directory.
723
+ * @param path A path to a directory. If a URL is provided, it must use the `file:` protocol.
724
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
725
+ */
726
+ function readdir(
727
+ path: PathLike,
728
+ options: {
729
+ encoding: "buffer";
730
+ withFileTypes: true;
731
+ recursive?: boolean | undefined;
732
+ },
733
+ ): Promise<Dirent<Buffer>[]>;
731
734
  /**
732
735
  * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is
733
736
  * fulfilled with the`linkString` upon success.
@@ -198,7 +198,7 @@ declare module "fs" {
198
198
  * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
199
199
  * @since v10.10.0
200
200
  */
201
- export class Dirent {
201
+ export class Dirent<Name extends string | Buffer = string> {
202
202
  /**
203
203
  * Returns `true` if the `fs.Dirent` object describes a regular file.
204
204
  * @since v10.10.0
@@ -241,7 +241,7 @@ declare module "fs" {
241
241
  * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}.
242
242
  * @since v10.10.0
243
243
  */
244
- name: string;
244
+ name: Name;
245
245
  /**
246
246
  * The base path that this `fs.Dirent` object refers to.
247
247
  * @since v20.12.0
@@ -2040,6 +2040,20 @@ declare module "fs" {
2040
2040
  },
2041
2041
  callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void,
2042
2042
  ): void;
2043
+ /**
2044
+ * Asynchronous readdir(3) - read a directory.
2045
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2046
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2047
+ */
2048
+ export function readdir(
2049
+ path: PathLike,
2050
+ options: {
2051
+ encoding: "buffer";
2052
+ withFileTypes: true;
2053
+ recursive?: boolean | undefined;
2054
+ },
2055
+ callback: (err: NodeJS.ErrnoException | null, files: Dirent<Buffer>[]) => void,
2056
+ ): void;
2043
2057
  export namespace readdir {
2044
2058
  /**
2045
2059
  * Asynchronous readdir(3) - read a directory.
@@ -2099,6 +2113,19 @@ declare module "fs" {
2099
2113
  recursive?: boolean | undefined;
2100
2114
  },
2101
2115
  ): Promise<Dirent[]>;
2116
+ /**
2117
+ * Asynchronous readdir(3) - read a directory.
2118
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2119
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2120
+ */
2121
+ function __promisify__(
2122
+ path: PathLike,
2123
+ options: {
2124
+ encoding: "buffer";
2125
+ withFileTypes: true;
2126
+ recursive?: boolean | undefined;
2127
+ },
2128
+ ): Promise<Dirent<Buffer>[]>;
2102
2129
  }
2103
2130
  /**
2104
2131
  * Reads the contents of the directory.
@@ -2166,6 +2193,19 @@ declare module "fs" {
2166
2193
  recursive?: boolean | undefined;
2167
2194
  },
2168
2195
  ): Dirent[];
2196
+ /**
2197
+ * Synchronous readdir(3) - read a directory.
2198
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2199
+ * @param options Must include `withFileTypes: true` and `encoding: 'buffer'`.
2200
+ */
2201
+ export function readdirSync(
2202
+ path: PathLike,
2203
+ options: {
2204
+ encoding: "buffer";
2205
+ withFileTypes: true;
2206
+ recursive?: boolean | undefined;
2207
+ },
2208
+ ): Dirent<Buffer>[];
2169
2209
  /**
2170
2210
  * Closes the file descriptor. No arguments other than a possible exception are
2171
2211
  * given to the completion callback.
@@ -2319,6 +2359,20 @@ declare module "fs" {
2319
2359
  * @since v0.1.96
2320
2360
  */
2321
2361
  export function fsyncSync(fd: number): void;
2362
+ export interface WriteOptions {
2363
+ /**
2364
+ * @default 0
2365
+ */
2366
+ offset?: number | undefined;
2367
+ /**
2368
+ * @default `buffer.byteLength - offset`
2369
+ */
2370
+ length?: number | undefined;
2371
+ /**
2372
+ * @default null
2373
+ */
2374
+ position?: number | undefined | null;
2375
+ }
2322
2376
  /**
2323
2377
  * Write `buffer` to the file specified by `fd`.
2324
2378
  *
@@ -2387,6 +2441,20 @@ declare module "fs" {
2387
2441
  buffer: TBuffer,
2388
2442
  callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
2389
2443
  ): void;
2444
+ /**
2445
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2446
+ * @param fd A file descriptor.
2447
+ * @param options An object with the following properties:
2448
+ * * `offset` The part of the buffer to be written. If not supplied, defaults to `0`.
2449
+ * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2450
+ * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2451
+ */
2452
+ export function write<TBuffer extends NodeJS.ArrayBufferView>(
2453
+ fd: number,
2454
+ buffer: TBuffer,
2455
+ options: WriteOptions,
2456
+ callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void,
2457
+ ): void;
2390
2458
  /**
2391
2459
  * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
2392
2460
  * @param fd A file descriptor.
@@ -2441,6 +2509,22 @@ declare module "fs" {
2441
2509
  bytesWritten: number;
2442
2510
  buffer: TBuffer;
2443
2511
  }>;
2512
+ /**
2513
+ * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
2514
+ * @param fd A file descriptor.
2515
+ * @param options An object with the following properties:
2516
+ * * `offset` The part of the buffer to be written. If not supplied, defaults to `0`.
2517
+ * * `length` The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
2518
+ * * `position` The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
2519
+ */
2520
+ function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
2521
+ fd: number,
2522
+ buffer?: TBuffer,
2523
+ options?: WriteOptions,
2524
+ ): Promise<{
2525
+ bytesWritten: number;
2526
+ buffer: TBuffer;
2527
+ }>;
2444
2528
  /**
2445
2529
  * Asynchronously writes `string` to the file referenced by the supplied file descriptor.
2446
2530
  * @param fd A file descriptor.
@@ -2684,7 +2768,7 @@ declare module "fs" {
2684
2768
  } & Abortable)
2685
2769
  | undefined
2686
2770
  | null,
2687
- callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
2771
+ callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
2688
2772
  ): void;
2689
2773
  /**
2690
2774
  * Asynchronously reads the entire contents of a file.
@@ -2719,7 +2803,7 @@ declare module "fs" {
2719
2803
  | BufferEncoding
2720
2804
  | undefined
2721
2805
  | null,
2722
- callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void,
2806
+ callback: (err: NodeJS.ErrnoException | null, data: string | NonSharedBuffer) => void,
2723
2807
  ): void;
2724
2808
  /**
2725
2809
  * Asynchronously reads the entire contents of a file.
@@ -2728,7 +2812,7 @@ declare module "fs" {
2728
2812
  */
2729
2813
  export function readFile(
2730
2814
  path: PathOrFileDescriptor,
2731
- callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void,
2815
+ callback: (err: NodeJS.ErrnoException | null, data: NonSharedBuffer) => void,
2732
2816
  ): void;
2733
2817
  export namespace readFile {
2734
2818
  /**
@@ -2744,7 +2828,7 @@ declare module "fs" {
2744
2828
  encoding?: null | undefined;
2745
2829
  flag?: string | undefined;
2746
2830
  } | null,
2747
- ): Promise<Buffer>;
2831
+ ): Promise<NonSharedBuffer>;
2748
2832
  /**
2749
2833
  * Asynchronously reads the entire contents of a file.
2750
2834
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2778,7 +2862,7 @@ declare module "fs" {
2778
2862
  })
2779
2863
  | BufferEncoding
2780
2864
  | null,
2781
- ): Promise<string | Buffer>;
2865
+ ): Promise<string | NonSharedBuffer>;
2782
2866
  }
2783
2867
  /**
2784
2868
  * Returns the contents of the `path`.
@@ -2810,7 +2894,7 @@ declare module "fs" {
2810
2894
  encoding?: null | undefined;
2811
2895
  flag?: string | undefined;
2812
2896
  } | null,
2813
- ): Buffer;
2897
+ ): NonSharedBuffer;
2814
2898
  /**
2815
2899
  * Synchronously reads the entire contents of a file.
2816
2900
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
@@ -2842,7 +2926,7 @@ declare module "fs" {
2842
2926
  })
2843
2927
  | BufferEncoding
2844
2928
  | null,
2845
- ): string | Buffer;
2929
+ ): string | NonSharedBuffer;
2846
2930
  export type WriteFileOptions =
2847
2931
  | (
2848
2932
  & ObjectEncodingOptions