@types/node 17.0.37 → 17.0.40

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.
node/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for Node.js (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: Tue, 31 May 2022 18:31:34 GMT
11
+ * Last updated: Sun, 05 Jun 2022 08:01:31 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`, `structuredClone`
14
14
 
node/fs/promises.d.ts CHANGED
@@ -11,6 +11,7 @@
11
11
  declare module 'fs/promises' {
12
12
  import { Abortable } from 'node:events';
13
13
  import { Stream } from 'node:stream';
14
+ import { ReadableStream } from 'node:stream/web';
14
15
  import {
15
16
  Stats,
16
17
  BigIntStats,
@@ -209,6 +210,29 @@ declare module 'fs/promises' {
209
210
  */
210
211
  read<T extends NodeJS.ArrayBufferView>(buffer: T, offset?: number | null, length?: number | null, position?: number | null): Promise<FileReadResult<T>>;
211
212
  read<T extends NodeJS.ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
213
+ /**
214
+ * Returns a `ReadableStream` that may be used to read the files data.
215
+ *
216
+ * An error will be thrown if this method is called more than once or is called after the `FileHandle` is closed
217
+ * or closing.
218
+ *
219
+ * ```js
220
+ * import { open } from 'node:fs/promises';
221
+ *
222
+ * const file = await open('./some/file/to/read');
223
+ *
224
+ * for await (const chunk of file.readableWebStream())
225
+ * console.log(chunk);
226
+ *
227
+ * await file.close();
228
+ * ```
229
+ *
230
+ * While the `ReadableStream` will read the file to completion, it will not close the `FileHandle` automatically. User code must still call the `fileHandle.close()` method.
231
+ *
232
+ * @since v17.0.0
233
+ * @experimental
234
+ */
235
+ readableWebStream(): ReadableStream;
212
236
  /**
213
237
  * Asynchronously reads the entire contents of a file.
214
238
  *
@@ -487,7 +511,7 @@ declare module 'fs/promises' {
487
511
  * @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created.
488
512
  * @return Fulfills with a {FileHandle} object.
489
513
  */
490
- function open(path: PathLike, flags: string | number, mode?: Mode): Promise<FileHandle>;
514
+ function open(path: PathLike, flags?: string | number, mode?: Mode): Promise<FileHandle>;
491
515
  /**
492
516
  * Renames `oldPath` to `newPath`.
493
517
  * @since v10.0.0
node/fs.d.ts CHANGED
@@ -1998,12 +1998,19 @@ declare module 'fs' {
1998
1998
  * @param [flags='r'] See `support of file system `flags``.
1999
1999
  * @param [mode=0o666]
2000
2000
  */
2001
- export function open(path: PathLike, flags: OpenMode, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2001
+ export function open(path: PathLike, flags: OpenMode | undefined, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2002
+ /**
2003
+ * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
2004
+ * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2005
+ * @param [flags='r'] See `support of file system `flags``.
2006
+ */
2007
+ export function open(path: PathLike, flags: OpenMode | undefined, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2002
2008
  /**
2003
2009
  * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
2004
2010
  * @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
2005
2011
  */
2006
- export function open(path: PathLike, flags: OpenMode, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2012
+ export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
2013
+
2007
2014
  export namespace open {
2008
2015
  /**
2009
2016
  * Asynchronous open(2) - open and possibly create a file.
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "17.0.37",
3
+ "version": "17.0.40",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -220,6 +220,6 @@
220
220
  },
221
221
  "scripts": {},
222
222
  "dependencies": {},
223
- "typesPublisherContentHash": "c6cc31e823440776df1d472e27a96eaeea82324ff3d04349017436ad1e821340",
223
+ "typesPublisherContentHash": "8924a04e799179c8e10493629b0bdf0c5388080a62ec2e413b2137b01ecc29c7",
224
224
  "typeScriptVersion": "3.9"
225
225
  }
node/process.d.ts CHANGED
@@ -642,7 +642,7 @@ declare module 'process' {
642
642
  * Android).
643
643
  * @since v0.1.31
644
644
  */
645
- getgid(): number;
645
+ getgid?: () => number;
646
646
  /**
647
647
  * The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a
648
648
  * numeric ID or a group name
@@ -669,7 +669,7 @@ declare module 'process' {
669
669
  * @since v0.1.31
670
670
  * @param id The group name or ID
671
671
  */
672
- setgid(id: number | string): void;
672
+ setgid?: (id: number | string) => void;
673
673
  /**
674
674
  * The `process.getuid()` method returns the numeric user identity of the process.
675
675
  * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).)
@@ -686,7 +686,7 @@ declare module 'process' {
686
686
  * Android).
687
687
  * @since v0.1.28
688
688
  */
689
- getuid(): number;
689
+ getuid?: () => number;
690
690
  /**
691
691
  * The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a
692
692
  * numeric ID or a username string.
@@ -712,7 +712,7 @@ declare module 'process' {
712
712
  * This feature is not available in `Worker` threads.
713
713
  * @since v0.1.28
714
714
  */
715
- setuid(id: number | string): void;
715
+ setuid?: (id: number | string) => void;
716
716
  /**
717
717
  * The `process.geteuid()` method returns the numerical effective user identity of
718
718
  * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).)
@@ -729,7 +729,7 @@ declare module 'process' {
729
729
  * Android).
730
730
  * @since v2.0.0
731
731
  */
732
- geteuid(): number;
732
+ geteuid?: () => number;
733
733
  /**
734
734
  * The `process.seteuid()` method sets the effective user identity of the process.
735
735
  * (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username
@@ -756,7 +756,7 @@ declare module 'process' {
756
756
  * @since v2.0.0
757
757
  * @param id A user name or ID
758
758
  */
759
- seteuid(id: number | string): void;
759
+ seteuid?: (id: number | string) => void;
760
760
  /**
761
761
  * The `process.getegid()` method returns the numerical effective group identity
762
762
  * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).)
@@ -773,7 +773,7 @@ declare module 'process' {
773
773
  * Android).
774
774
  * @since v2.0.0
775
775
  */
776
- getegid(): number;
776
+ getegid?: () => number;
777
777
  /**
778
778
  * The `process.setegid()` method sets the effective group identity of the process.
779
779
  * (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group
@@ -800,7 +800,7 @@ declare module 'process' {
800
800
  * @since v2.0.0
801
801
  * @param id A group name or ID
802
802
  */
803
- setegid(id: number | string): void;
803
+ setegid?: (id: number | string) => void;
804
804
  /**
805
805
  * The `process.getgroups()` method returns an array with the supplementary group
806
806
  * IDs. POSIX leaves it unspecified if the effective group ID is included but
@@ -818,7 +818,7 @@ declare module 'process' {
818
818
  * Android).
819
819
  * @since v0.9.4
820
820
  */
821
- getgroups(): number[];
821
+ getgroups?: () => number[];
822
822
  /**
823
823
  * The `process.setgroups()` method sets the supplementary group IDs for the
824
824
  * Node.js process. This is a privileged operation that requires the Node.js
@@ -844,7 +844,7 @@ declare module 'process' {
844
844
  * This feature is not available in `Worker` threads.
845
845
  * @since v0.9.4
846
846
  */
847
- setgroups(groups: ReadonlyArray<string | number>): void;
847
+ setgroups?: (groups: ReadonlyArray<string | number>) => void;
848
848
  /**
849
849
  * The `process.setUncaughtExceptionCaptureCallback()` function sets a function
850
850
  * that will be invoked when an uncaught exception occurs, which will receive the