@types/node 25.3.3 → 25.4.0

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/util.d.ts CHANGED
@@ -308,6 +308,9 @@ declare module "node:util" {
308
308
  * Returns an array of call site objects containing the stack of
309
309
  * the caller function.
310
310
  *
311
+ * Unlike accessing an `error.stack`, the result returned from this API is not
312
+ * interfered with `Error.prepareStackTrace`.
313
+ *
311
314
  * ```js
312
315
  * import { getCallSites } from 'node:util';
313
316
  *
@@ -320,7 +323,7 @@ declare module "node:util" {
320
323
  * console.log(`Function Name: ${callSite.functionName}`);
321
324
  * console.log(`Script Name: ${callSite.scriptName}`);
322
325
  * console.log(`Line Number: ${callSite.lineNumber}`);
323
- * console.log(`Column Number: ${callSite.column}`);
326
+ * console.log(`Column Number: ${callSite.columnNumber}`);
324
327
  * });
325
328
  * // CallSite 1:
326
329
  * // Function Name: exampleFunction
@@ -750,6 +753,28 @@ declare module "node:util" {
750
753
  * @legacy Use ES2015 class syntax and `extends` keyword instead.
751
754
  */
752
755
  export function inherits(constructor: unknown, superConstructor: unknown): void;
756
+ /**
757
+ * The `util.convertProcessSignalToExitCode()` method converts a signal name to its
758
+ * corresponding POSIX exit code. Following the POSIX standard, the exit code
759
+ * for a process terminated by a signal is calculated as `128 + signal number`.
760
+ *
761
+ * If `signal` is not a valid signal name, then an error will be thrown. See
762
+ * [`signal(7)`](https://man7.org/linux/man-pages/man7/signal.7.html) for a list of valid signals.
763
+ *
764
+ * ```js
765
+ * import { convertProcessSignalToExitCode } from 'node:util';
766
+ *
767
+ * console.log(convertProcessSignalToExitCode('SIGTERM')); // 143 (128 + 15)
768
+ * console.log(convertProcessSignalToExitCode('SIGKILL')); // 137 (128 + 9)
769
+ * ```
770
+ *
771
+ * This is particularly useful when working with processes to determine
772
+ * the exit code based on the signal that terminated the process.
773
+ * @since v25.4.0
774
+ * @param signal A signal name (e.g. `'SIGTERM'`)
775
+ * @returns The exit code corresponding to `signal`
776
+ */
777
+ export function convertProcessSignalToExitCode(signal: NodeJS.Signals): number;
753
778
  export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void;
754
779
  export interface DebugLogger extends DebugLoggerFunction {
755
780
  /**
@@ -804,7 +829,7 @@ declare module "node:util" {
804
829
  *
805
830
  * ```js
806
831
  * import { debuglog } from 'node:util';
807
- * const log = debuglog('foo');
832
+ * const log = debuglog('foo-bar');
808
833
  *
809
834
  * log('hi there, it\'s foo-bar [%d]', 2333);
810
835
  * ```
node/v8.d.ts CHANGED
@@ -308,7 +308,6 @@ declare module "node:v8" {
308
308
  * ```
309
309
  * @param ctor The constructor that can be used to search on the prototype chain in order to filter target objects in the heap.
310
310
  * @since v20.13.0
311
- * @experimental
312
311
  */
313
312
  function queryObjects(ctor: Function): number | string[];
314
313
  function queryObjects(ctor: Function, options: { format: "count" }): number;
node/worker_threads.d.ts CHANGED
@@ -33,8 +33,8 @@
33
33
  * workerData: script,
34
34
  * });
35
35
  * worker.on('message', resolve);
36
- * worker.on('error', reject);
37
- * worker.on('exit', (code) => {
36
+ * worker.once('error', reject);
37
+ * worker.once('exit', (code) => {
38
38
  * if (code !== 0)
39
39
  * reject(new Error(`Worker stopped with exit code ${code}`));
40
40
  * });
node/zlib.d.ts CHANGED
@@ -108,10 +108,14 @@ declare module "node:zlib" {
108
108
  */
109
109
  chunkSize?: number | undefined;
110
110
  windowBits?: number | undefined;
111
- level?: number | undefined; // compression only
112
- memLevel?: number | undefined; // compression only
113
- strategy?: number | undefined; // compression only
114
- dictionary?: NodeJS.ArrayBufferView | ArrayBuffer | undefined; // deflate/inflate only, empty dictionary by default
111
+ /** compression only */
112
+ level?: number | undefined;
113
+ /** compression only */
114
+ memLevel?: number | undefined;
115
+ /** compression only */
116
+ strategy?: number | undefined;
117
+ /** deflate/inflate only, empty dictionary by default */
118
+ dictionary?: NodeJS.ArrayBufferView | ArrayBuffer | undefined;
115
119
  /**
116
120
  * If `true`, returns an object with `buffer` and `engine`.
117
121
  */
@@ -201,24 +205,84 @@ declare module "node:zlib" {
201
205
  interface ZlibReset {
202
206
  reset(): void;
203
207
  }
208
+ /**
209
+ * @since v10.16.0
210
+ */
211
+ class BrotliCompress extends stream.Transform {
212
+ constructor(options?: BrotliOptions);
213
+ }
204
214
  interface BrotliCompress extends stream.Transform, Zlib {}
215
+ /**
216
+ * @since v10.16.0
217
+ */
218
+ class BrotliDecompress extends stream.Transform {
219
+ constructor(options?: BrotliOptions);
220
+ }
205
221
  interface BrotliDecompress extends stream.Transform, Zlib {}
222
+ /**
223
+ * @since v0.5.8
224
+ */
225
+ class Gzip extends stream.Transform {
226
+ constructor(options?: ZlibOptions);
227
+ }
206
228
  interface Gzip extends stream.Transform, Zlib {}
229
+ /**
230
+ * @since v0.5.8
231
+ */
232
+ class Gunzip extends stream.Transform {
233
+ constructor(options?: ZlibOptions);
234
+ }
207
235
  interface Gunzip extends stream.Transform, Zlib {}
236
+ /**
237
+ * @since v0.5.8
238
+ */
239
+ class Deflate extends stream.Transform {
240
+ constructor(options?: ZlibOptions);
241
+ }
208
242
  interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
243
+ /**
244
+ * @since v0.5.8
245
+ */
246
+ class Inflate extends stream.Transform {
247
+ constructor(options?: ZlibOptions);
248
+ }
209
249
  interface Inflate extends stream.Transform, Zlib, ZlibReset {}
250
+ /**
251
+ * @since v0.5.8
252
+ */
253
+ class DeflateRaw extends stream.Transform {
254
+ constructor(options?: ZlibOptions);
255
+ }
210
256
  interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams {}
257
+ /**
258
+ * @since v0.5.8
259
+ */
260
+ class InflateRaw extends stream.Transform {
261
+ constructor(options?: ZlibOptions);
262
+ }
211
263
  interface InflateRaw extends stream.Transform, Zlib, ZlibReset {}
264
+ /**
265
+ * @since v0.5.8
266
+ */
267
+ class Unzip extends stream.Transform {
268
+ constructor(options?: ZlibOptions);
269
+ }
212
270
  interface Unzip extends stream.Transform, Zlib {}
213
271
  /**
214
272
  * @since v22.15.0
215
273
  * @experimental
216
274
  */
275
+ class ZstdCompress extends stream.Transform {
276
+ constructor(options?: ZstdOptions);
277
+ }
217
278
  interface ZstdCompress extends stream.Transform, Zlib {}
218
279
  /**
219
280
  * @since v22.15.0
220
281
  * @experimental
221
282
  */
283
+ class ZstdDecompress extends stream.Transform {
284
+ constructor(options?: ZstdOptions);
285
+ }
222
286
  interface ZstdDecompress extends stream.Transform, Zlib {}
223
287
  /**
224
288
  * Computes a 32-bit [Cyclic Redundancy Check](https://en.wikipedia.org/wiki/Cyclic_redundancy_check) checksum of `data`.