@types/node 17.0.22 → 17.0.25

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 (5) hide show
  1. node/README.md +1 -1
  2. node/buffer.d.ts +1 -1
  3. node/fs.d.ts +48 -14
  4. node/net.d.ts +7 -0
  5. node/package.json +2 -2
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: Mon, 21 Mar 2022 17:01:46 GMT
11
+ * Last updated: Mon, 18 Apr 2022 16:31:18 GMT
12
12
  * Dependencies: none
13
13
  * Global values: `AbortController`, `AbortSignal`, `__dirname`, `__filename`, `console`, `exports`, `gc`, `global`, `module`, `process`, `require`
14
14
 
node/buffer.d.ts CHANGED
@@ -443,7 +443,7 @@ declare module 'buffer' {
443
443
  * 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.
444
444
  *
445
445
  * The underlying memory for `Buffer` instances created in this way is _not_
446
- * _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.
446
+ * _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.
447
447
  *
448
448
  * ```js
449
449
  * import { Buffer } from 'buffer';
node/fs.d.ts CHANGED
@@ -2233,6 +2233,23 @@ declare module 'fs' {
2233
2233
  */
2234
2234
  export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number;
2235
2235
  export type ReadPosition = number | bigint;
2236
+ export interface ReadSyncOptions {
2237
+ /**
2238
+ * @default 0
2239
+ */
2240
+ offset?: number | undefined;
2241
+ /**
2242
+ * @default `length of buffer`
2243
+ */
2244
+ length?: number | undefined;
2245
+ /**
2246
+ * @default null
2247
+ */
2248
+ position?: ReadPosition | null | undefined;
2249
+ }
2250
+ export interface ReadAsyncOptions<TBuffer extends NodeJS.ArrayBufferView> extends ReadSyncOptions {
2251
+ buffer?: TBuffer;
2252
+ }
2236
2253
  /**
2237
2254
  * Read data from the file specified by `fd`.
2238
2255
  *
@@ -2258,6 +2275,24 @@ declare module 'fs' {
2258
2275
  position: ReadPosition | null,
2259
2276
  callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void
2260
2277
  ): void;
2278
+ /**
2279
+ * Similar to the above `fs.read` function, this version takes an optional `options` object.
2280
+ * If not otherwise specified in an `options` object,
2281
+ * `buffer` defaults to `Buffer.alloc(16384)`,
2282
+ * `offset` defaults to `0`,
2283
+ * `length` defaults to `buffer.byteLength`, `- offset` as of Node 17.6.0
2284
+ * `position` defaults to `null`
2285
+ * @since v12.17.0, 13.11.0
2286
+ */
2287
+ export function read<TBuffer extends NodeJS.ArrayBufferView>(
2288
+ fd: number,
2289
+ options: ReadAsyncOptions<TBuffer>,
2290
+ callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void
2291
+ ): void;
2292
+ export function read(
2293
+ fd: number,
2294
+ callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void
2295
+ ): void;
2261
2296
  export namespace read {
2262
2297
  /**
2263
2298
  * @param fd A file descriptor.
@@ -2276,20 +2311,19 @@ declare module 'fs' {
2276
2311
  bytesRead: number;
2277
2312
  buffer: TBuffer;
2278
2313
  }>;
2279
- }
2280
- export interface ReadSyncOptions {
2281
- /**
2282
- * @default 0
2283
- */
2284
- offset?: number | undefined;
2285
- /**
2286
- * @default `length of buffer`
2287
- */
2288
- length?: number | undefined;
2289
- /**
2290
- * @default null
2291
- */
2292
- position?: ReadPosition | null | undefined;
2314
+ function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
2315
+ fd: number,
2316
+ options: ReadAsyncOptions<TBuffer>
2317
+ ): Promise<{
2318
+ bytesRead: number;
2319
+ buffer: TBuffer;
2320
+ }>;
2321
+ function __promisify__(
2322
+ fd: number
2323
+ ): Promise<{
2324
+ bytesRead: number;
2325
+ buffer: NodeJS.ArrayBufferView;
2326
+ }>;
2293
2327
  }
2294
2328
  /**
2295
2329
  * Returns the number of `bytesRead`.
node/net.d.ts CHANGED
@@ -59,6 +59,7 @@ declare module 'net' {
59
59
  path: string;
60
60
  }
61
61
  type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
62
+ type SocketReadyState = 'opening' | 'open' | 'readOnly' | 'writeOnly' | 'closed';
62
63
  /**
63
64
  * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint
64
65
  * (uses named pipes on Windows, and Unix domain sockets otherwise). It is also
@@ -262,6 +263,12 @@ declare module 'net' {
262
263
  * @since v0.9.6
263
264
  */
264
265
  readonly localPort?: number;
266
+ /**
267
+ * This property represents the state of the connection as a string.
268
+ * @see {https://nodejs.org/api/net.html#socketreadystate}
269
+ * @since v0.5.0
270
+ */
271
+ readonly readyState: SocketReadyState;
265
272
  /**
266
273
  * The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if
267
274
  * the socket is destroyed (for example, if the client disconnected).
node/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/node",
3
- "version": "17.0.22",
3
+ "version": "17.0.25",
4
4
  "description": "TypeScript definitions for Node.js",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
6
6
  "license": "MIT",
@@ -215,6 +215,6 @@
215
215
  },
216
216
  "scripts": {},
217
217
  "dependencies": {},
218
- "typesPublisherContentHash": "4da218eb4092cdc01c961d35daf8323ee4c224bdd48d05913036fb5d4775a910",
218
+ "typesPublisherContentHash": "825e787f0a7c6fde372f102a7e96d0c64b5cb4ff7c07557941bedf371f097b76",
219
219
  "typeScriptVersion": "3.9"
220
220
  }