@contrast/agent-bundle 5.45.1 → 5.47.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.
- package/README.md +1 -1
- package/node_modules/@contrast/agent/README.md +1 -1
- package/node_modules/@contrast/agent/package.json +12 -12
- package/node_modules/@contrast/agentify/package.json +15 -15
- package/node_modules/@contrast/architecture-components/package.json +5 -5
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/common.js +1 -1
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/handlers.js +24 -11
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/index.js +6 -4
- package/node_modules/@contrast/assess/lib/configuration-analysis/install/apollo-server.js +92 -0
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/express-session.js +2 -2
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/fastify-cookie.js +2 -2
- package/node_modules/@contrast/assess/lib/configuration-analysis/install/graphql-yoga.js +90 -0
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/hapi.js +2 -2
- package/node_modules/@contrast/assess/lib/{session-configuration → configuration-analysis}/install/koa.js +3 -3
- package/node_modules/@contrast/assess/lib/dataflow/propagation/install/string/substring.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/handler.js +30 -26
- package/node_modules/@contrast/assess/lib/dataflow/sources/index.js +2 -0
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/fastify-websocket.js +63 -0
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/http.js +42 -38
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/index.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-bodyparsers.js +76 -48
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-multer.js +1 -1
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/koa-routers.js +2 -2
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/koa/{koa2.js → koa.js} +3 -3
- package/node_modules/@contrast/assess/lib/dataflow/sources/install/socket.io.js +80 -0
- package/node_modules/@contrast/assess/lib/get-source-context.js +10 -21
- package/node_modules/@contrast/assess/lib/index.d.ts +4 -3
- package/node_modules/@contrast/assess/lib/index.js +2 -2
- package/node_modules/@contrast/assess/lib/make-source-context.js +5 -10
- package/node_modules/@contrast/assess/lib/policy.js +400 -0
- package/node_modules/@contrast/assess/lib/response-scanning/handlers/index.js +10 -14
- package/node_modules/@contrast/assess/package.json +12 -12
- package/node_modules/@contrast/common/lib/constants.d.ts +12 -4
- package/node_modules/@contrast/common/lib/constants.js +16 -7
- package/node_modules/@contrast/common/lib/types.d.ts +5 -1
- package/node_modules/@contrast/common/package.json +1 -1
- package/node_modules/@contrast/config/lib/common.js +1 -0
- package/node_modules/@contrast/config/lib/options.js +14 -0
- package/node_modules/@contrast/config/package.json +3 -3
- package/node_modules/@contrast/core/package.json +5 -5
- package/node_modules/@contrast/deadzones/package.json +5 -5
- package/node_modules/@contrast/dep-hooks/lib/package-finder.d.ts +2 -2
- package/node_modules/@contrast/dep-hooks/lib/package-finder.js +3 -2
- package/node_modules/@contrast/dep-hooks/package.json +4 -4
- package/node_modules/@contrast/esm-hooks/README.md +2 -2
- package/node_modules/@contrast/esm-hooks/package.json +6 -6
- package/node_modules/@contrast/instrumentation/package.json +5 -5
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/dep.json +149 -149
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/index.js +2 -11
- package/node_modules/@contrast/library-analysis/lib/install/library-reporting/utils.js +2 -0
- package/node_modules/@contrast/library-analysis/lib/install/library-usage/index.js +3 -1
- package/node_modules/@contrast/library-analysis/lib/util.js +0 -2
- package/node_modules/@contrast/library-analysis/package.json +4 -4
- package/node_modules/@contrast/logger/package.json +3 -3
- package/node_modules/@contrast/metrics/package.json +6 -6
- package/node_modules/@contrast/patcher/package.json +2 -2
- package/node_modules/@contrast/protect/lib/error-handlers/index.js +1 -1
- package/node_modules/@contrast/protect/lib/error-handlers/install/{koa2.js → koa.js} +4 -4
- package/node_modules/@contrast/protect/lib/index.d.ts +1 -1
- package/node_modules/@contrast/protect/lib/input-analysis/handlers.js +1 -12
- package/node_modules/@contrast/protect/lib/input-analysis/index.js +2 -3
- package/node_modules/@contrast/protect/lib/input-analysis/install/koa-bodyparsers.js +92 -0
- package/node_modules/@contrast/protect/lib/input-analysis/install/{koa2.js → koa.js} +5 -5
- package/node_modules/@contrast/protect/package.json +11 -11
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/application-activity/translations.js +6 -10
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/routes-observed.js +4 -0
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.d.ts +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/index.js +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.d.ts +1 -1
- package/node_modules/@contrast/reporter/lib/reporters/contrast-ui/endpoints/traces/translations.js +22 -9
- package/node_modules/@contrast/reporter/lib/reporters/file.js +1 -1
- package/node_modules/@contrast/reporter/package.json +6 -6
- package/node_modules/@contrast/rewriter/package.json +5 -5
- package/node_modules/@contrast/route-coverage/lib/index.d.ts +0 -2
- package/node_modules/@contrast/route-coverage/lib/index.js +10 -1
- package/node_modules/@contrast/route-coverage/lib/install/express/express5.js +16 -1
- package/node_modules/@contrast/route-coverage/lib/install/fastify.js +25 -15
- package/node_modules/@contrast/route-coverage/lib/install/graphql.js +6 -1
- package/node_modules/@contrast/route-coverage/lib/install/koa.js +1 -1
- package/node_modules/@contrast/route-coverage/lib/install/socket.io.js +127 -0
- package/node_modules/@contrast/route-coverage/package.json +8 -8
- package/node_modules/@contrast/scopes/package.json +5 -5
- package/node_modules/@contrast/sec-obs/package.json +9 -9
- package/node_modules/@contrast/sources/lib/index.js +65 -22
- package/node_modules/@contrast/sources/lib/index.test.js +78 -33
- package/node_modules/@contrast/sources/lib/source-info.js +1 -10
- package/node_modules/@contrast/sources/package.json +3 -3
- package/node_modules/@contrast/telemetry/package.json +5 -5
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/assert/strict.d.ts +105 -2
- package/node_modules/@types/node/assert.d.ts +154 -95
- package/node_modules/@types/node/buffer.buffer.d.ts +9 -0
- package/node_modules/@types/node/buffer.d.ts +8 -4
- package/node_modules/@types/node/child_process.d.ts +65 -42
- package/node_modules/@types/node/cluster.d.ts +4 -5
- package/node_modules/@types/node/crypto.d.ts +1173 -322
- package/node_modules/@types/node/dgram.d.ts +9 -8
- package/node_modules/@types/node/diagnostics_channel.d.ts +0 -2
- package/node_modules/@types/node/dns.d.ts +1 -1
- package/node_modules/@types/node/events.d.ts +80 -34
- package/node_modules/@types/node/fs/promises.d.ts +39 -21
- package/node_modules/@types/node/fs.d.ts +328 -87
- package/node_modules/@types/node/globals.d.ts +2 -0
- package/node_modules/@types/node/globals.typedarray.d.ts +19 -0
- package/node_modules/@types/node/http.d.ts +94 -30
- package/node_modules/@types/node/http2.d.ts +178 -52
- package/node_modules/@types/node/https.d.ts +91 -62
- package/node_modules/@types/node/index.d.ts +2 -0
- package/node_modules/@types/node/inspector.d.ts +24 -0
- package/node_modules/@types/node/inspector.generated.d.ts +181 -0
- package/node_modules/@types/node/net.d.ts +12 -11
- package/node_modules/@types/node/os.d.ts +14 -3
- package/node_modules/@types/node/package.json +3 -3
- package/node_modules/@types/node/perf_hooks.d.ts +6 -8
- package/node_modules/@types/node/process.d.ts +12 -23
- package/node_modules/@types/node/readline/promises.d.ts +1 -1
- package/node_modules/@types/node/sea.d.ts +9 -0
- package/node_modules/@types/node/sqlite.d.ts +119 -10
- package/node_modules/@types/node/stream/consumers.d.ts +2 -2
- package/node_modules/@types/node/stream/web.d.ts +6 -55
- package/node_modules/@types/node/stream.d.ts +38 -23
- package/node_modules/@types/node/string_decoder.d.ts +2 -2
- package/node_modules/@types/node/test.d.ts +31 -26
- package/node_modules/@types/node/tls.d.ts +90 -66
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +10 -2
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +16 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +2 -0
- package/node_modules/@types/node/ts5.7/index.d.ts +2 -0
- package/node_modules/@types/node/url.d.ts +8 -3
- package/node_modules/@types/node/util.d.ts +17 -3
- package/node_modules/@types/node/v8.d.ts +38 -5
- package/node_modules/@types/node/vm.d.ts +169 -88
- package/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
- package/node_modules/@types/node/web-globals/events.d.ts +3 -0
- package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
- package/node_modules/@types/node/worker_threads.d.ts +109 -48
- package/node_modules/@types/node/zlib.d.ts +31 -24
- package/node_modules/axios/CHANGELOG.md +403 -357
- package/node_modules/axios/README.md +80 -49
- package/node_modules/axios/dist/axios.js +121 -46
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +126 -57
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +126 -57
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +346 -97
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +4 -0
- package/node_modules/axios/index.d.ts +4 -0
- package/node_modules/axios/lib/adapters/adapters.js +85 -40
- package/node_modules/axios/lib/adapters/fetch.js +1 -1
- package/node_modules/axios/lib/adapters/http.js +220 -42
- package/node_modules/axios/lib/core/InterceptorManager.js +1 -1
- package/node_modules/axios/lib/core/mergeConfig.js +4 -4
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/HttpStatusCode.js +6 -0
- package/node_modules/axios/lib/helpers/bind.js +7 -0
- package/node_modules/axios/lib/helpers/cookies.js +24 -13
- package/node_modules/axios/package.json +9 -4
- package/node_modules/detect-libc/lib/filesystem.js +1 -1
- package/node_modules/detect-libc/package.json +3 -1
- package/node_modules/node-abi/abi_registry.json +12 -2
- package/node_modules/node-abi/package.json +3 -6
- package/node_modules/semver/classes/range.js +1 -0
- package/node_modules/semver/classes/semver.js +19 -5
- package/node_modules/semver/internal/identifiers.js +4 -0
- package/node_modules/semver/package.json +3 -3
- package/node_modules/undici-types/agent.d.ts +1 -4
- package/node_modules/undici-types/client.d.ts +0 -2
- package/node_modules/undici-types/diagnostics-channel.d.ts +0 -1
- package/node_modules/undici-types/dispatcher.d.ts +0 -6
- package/node_modules/undici-types/errors.d.ts +5 -15
- package/node_modules/undici-types/eventsource.d.ts +6 -1
- package/node_modules/undici-types/h2c-client.d.ts +0 -2
- package/node_modules/undici-types/index.d.ts +6 -1
- package/node_modules/undici-types/interceptors.d.ts +5 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +0 -1
- package/node_modules/undici-types/package.json +1 -1
- package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
- package/node_modules/undici-types/webidl.d.ts +82 -21
- package/package.json +3 -3
- package/node_modules/@contrast/assess/lib/get-policy.js +0 -336
- package/node_modules/@contrast/protect/lib/input-analysis/install/koa-body5.js +0 -63
- package/node_modules/@contrast/protect/lib/input-analysis/install/koa-bodyparser4.js +0 -64
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/fs.js)
|
|
20
20
|
*/
|
|
21
21
|
declare module "fs" {
|
|
22
|
+
import { NonSharedBuffer } from "node:buffer";
|
|
22
23
|
import * as stream from "node:stream";
|
|
23
24
|
import { Abortable, EventEmitter } from "node:events";
|
|
24
25
|
import { URL } from "node:url";
|
|
@@ -394,23 +395,29 @@ declare module "fs" {
|
|
|
394
395
|
* 3. error
|
|
395
396
|
*/
|
|
396
397
|
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
397
|
-
addListener(event: "change", listener: (eventType: string, filename: string |
|
|
398
|
+
addListener(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
398
399
|
addListener(event: "close", listener: () => void): this;
|
|
399
400
|
addListener(event: "error", listener: (error: Error) => void): this;
|
|
400
401
|
on(event: string, listener: (...args: any[]) => void): this;
|
|
401
|
-
on(event: "change", listener: (eventType: string, filename: string |
|
|
402
|
+
on(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
402
403
|
on(event: "close", listener: () => void): this;
|
|
403
404
|
on(event: "error", listener: (error: Error) => void): this;
|
|
404
405
|
once(event: string, listener: (...args: any[]) => void): this;
|
|
405
|
-
once(event: "change", listener: (eventType: string, filename: string |
|
|
406
|
+
once(event: "change", listener: (eventType: string, filename: string | NonSharedBuffer) => void): this;
|
|
406
407
|
once(event: "close", listener: () => void): this;
|
|
407
408
|
once(event: "error", listener: (error: Error) => void): this;
|
|
408
409
|
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
409
|
-
prependListener(
|
|
410
|
+
prependListener(
|
|
411
|
+
event: "change",
|
|
412
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
413
|
+
): this;
|
|
410
414
|
prependListener(event: "close", listener: () => void): this;
|
|
411
415
|
prependListener(event: "error", listener: (error: Error) => void): this;
|
|
412
416
|
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
413
|
-
prependOnceListener(
|
|
417
|
+
prependOnceListener(
|
|
418
|
+
event: "change",
|
|
419
|
+
listener: (eventType: string, filename: string | NonSharedBuffer) => void,
|
|
420
|
+
): this;
|
|
414
421
|
prependOnceListener(event: "close", listener: () => void): this;
|
|
415
422
|
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
|
416
423
|
}
|
|
@@ -450,6 +457,230 @@ declare module "fs" {
|
|
|
450
457
|
prependListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
|
|
451
458
|
prependOnceListener<K extends keyof ReadStreamEvents>(event: K, listener: ReadStreamEvents[K]): this;
|
|
452
459
|
}
|
|
460
|
+
export interface Utf8StreamOptions {
|
|
461
|
+
/**
|
|
462
|
+
* Appends writes to dest file instead of truncating it.
|
|
463
|
+
* @default true
|
|
464
|
+
*/
|
|
465
|
+
append?: boolean | undefined;
|
|
466
|
+
/**
|
|
467
|
+
* Which type of data you can send to the write
|
|
468
|
+
* function, supported values are `'utf8'` or `'buffer'`.
|
|
469
|
+
* @default 'utf8'
|
|
470
|
+
*/
|
|
471
|
+
contentMode?: "utf8" | "buffer" | undefined;
|
|
472
|
+
/**
|
|
473
|
+
* A path to a file to be written to (mode controlled by the
|
|
474
|
+
* append option).
|
|
475
|
+
*/
|
|
476
|
+
dest?: string | undefined;
|
|
477
|
+
/**
|
|
478
|
+
* A file descriptor, something that is returned by `fs.open()`
|
|
479
|
+
* or `fs.openSync()`.
|
|
480
|
+
*/
|
|
481
|
+
fd?: number | undefined;
|
|
482
|
+
/**
|
|
483
|
+
* An object that has the same API as the `fs` module, useful
|
|
484
|
+
* for mocking, testing, or customizing the behavior of the stream.
|
|
485
|
+
*/
|
|
486
|
+
fs?: object | undefined;
|
|
487
|
+
/**
|
|
488
|
+
* Perform a `fs.fsyncSync()` every time a write is
|
|
489
|
+
* completed.
|
|
490
|
+
*/
|
|
491
|
+
fsync?: boolean | undefined;
|
|
492
|
+
/**
|
|
493
|
+
* The maximum length of the internal buffer. If a write
|
|
494
|
+
* operation would cause the buffer to exceed `maxLength`, the data written is
|
|
495
|
+
* dropped and a drop event is emitted with the dropped data
|
|
496
|
+
*/
|
|
497
|
+
maxLength?: number | undefined;
|
|
498
|
+
/**
|
|
499
|
+
* The maximum number of bytes that can be written;
|
|
500
|
+
* @default 16384
|
|
501
|
+
*/
|
|
502
|
+
maxWrite?: number | undefined;
|
|
503
|
+
/**
|
|
504
|
+
* The minimum length of the internal buffer that is
|
|
505
|
+
* required to be full before flushing.
|
|
506
|
+
*/
|
|
507
|
+
minLength?: number | undefined;
|
|
508
|
+
/**
|
|
509
|
+
* Ensure directory for `dest` file exists when true.
|
|
510
|
+
* @default false
|
|
511
|
+
*/
|
|
512
|
+
mkdir?: boolean | undefined;
|
|
513
|
+
/**
|
|
514
|
+
* Specify the creating file mode (see `fs.open()`).
|
|
515
|
+
*/
|
|
516
|
+
mode?: number | string | undefined;
|
|
517
|
+
/**
|
|
518
|
+
* Calls flush every `periodicFlush` milliseconds.
|
|
519
|
+
*/
|
|
520
|
+
periodicFlush?: number | undefined;
|
|
521
|
+
/**
|
|
522
|
+
* A function that will be called when `write()`,
|
|
523
|
+
* `writeSync()`, or `flushSync()` encounters an `EAGAIN` or `EBUSY` error.
|
|
524
|
+
* If the return value is `true` the operation will be retried, otherwise it
|
|
525
|
+
* will bubble the error. The `err` is the error that caused this function to
|
|
526
|
+
* be called, `writeBufferLen` is the length of the buffer that was written,
|
|
527
|
+
* and `remainingBufferLen` is the length of the remaining buffer that the
|
|
528
|
+
* stream did not try to write.
|
|
529
|
+
*/
|
|
530
|
+
retryEAGAIN?: ((err: Error | null, writeBufferLen: number, remainingBufferLen: number) => boolean) | undefined;
|
|
531
|
+
/**
|
|
532
|
+
* Perform writes synchronously.
|
|
533
|
+
*/
|
|
534
|
+
sync?: boolean | undefined;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* An optimized UTF-8 stream writer that allows for flushing all the internal
|
|
538
|
+
* buffering on demand. It handles `EAGAIN` errors correctly, allowing for
|
|
539
|
+
* customization, for example, by dropping content if the disk is busy.
|
|
540
|
+
* @since v24.6.0
|
|
541
|
+
* @experimental
|
|
542
|
+
*/
|
|
543
|
+
export class Utf8Stream extends EventEmitter {
|
|
544
|
+
constructor(options: Utf8StreamOptions);
|
|
545
|
+
/**
|
|
546
|
+
* Whether the stream is appending to the file or truncating it.
|
|
547
|
+
*/
|
|
548
|
+
readonly append: boolean;
|
|
549
|
+
/**
|
|
550
|
+
* The type of data that can be written to the stream. Supported
|
|
551
|
+
* values are `'utf8'` or `'buffer'`.
|
|
552
|
+
* @default 'utf8'
|
|
553
|
+
*/
|
|
554
|
+
readonly contentMode: "utf8" | "buffer";
|
|
555
|
+
/**
|
|
556
|
+
* Close the stream immediately, without flushing the internal buffer.
|
|
557
|
+
*/
|
|
558
|
+
destroy(): void;
|
|
559
|
+
/**
|
|
560
|
+
* Close the stream gracefully, flushing the internal buffer before closing.
|
|
561
|
+
*/
|
|
562
|
+
end(): void;
|
|
563
|
+
/**
|
|
564
|
+
* The file descriptor that is being written to.
|
|
565
|
+
*/
|
|
566
|
+
readonly fd: number;
|
|
567
|
+
/**
|
|
568
|
+
* The file that is being written to.
|
|
569
|
+
*/
|
|
570
|
+
readonly file: string;
|
|
571
|
+
/**
|
|
572
|
+
* Writes the current buffer to the file if a write was not in progress. Do
|
|
573
|
+
* nothing if `minLength` is zero or if it is already writing.
|
|
574
|
+
*/
|
|
575
|
+
flush(callback: (err: Error | null) => void): void;
|
|
576
|
+
/**
|
|
577
|
+
* Flushes the buffered data synchronously. This is a costly operation.
|
|
578
|
+
*/
|
|
579
|
+
flushSync(): void;
|
|
580
|
+
/**
|
|
581
|
+
* Whether the stream is performing a `fs.fsyncSync()` after every
|
|
582
|
+
* write operation.
|
|
583
|
+
*/
|
|
584
|
+
readonly fsync: boolean;
|
|
585
|
+
/**
|
|
586
|
+
* The maximum length of the internal buffer. If a write
|
|
587
|
+
* operation would cause the buffer to exceed `maxLength`, the data written is
|
|
588
|
+
* dropped and a drop event is emitted with the dropped data.
|
|
589
|
+
*/
|
|
590
|
+
readonly maxLength: number;
|
|
591
|
+
/**
|
|
592
|
+
* The minimum length of the internal buffer that is required to be
|
|
593
|
+
* full before flushing.
|
|
594
|
+
*/
|
|
595
|
+
readonly minLength: number;
|
|
596
|
+
/**
|
|
597
|
+
* Whether the stream should ensure that the directory for the
|
|
598
|
+
* `dest` file exists. If `true`, it will create the directory if it does not
|
|
599
|
+
* exist.
|
|
600
|
+
* @default false
|
|
601
|
+
*/
|
|
602
|
+
readonly mkdir: boolean;
|
|
603
|
+
/**
|
|
604
|
+
* The mode of the file that is being written to.
|
|
605
|
+
*/
|
|
606
|
+
readonly mode: number | string;
|
|
607
|
+
/**
|
|
608
|
+
* The number of milliseconds between flushes. If set to `0`, no
|
|
609
|
+
* periodic flushes will be performed.
|
|
610
|
+
*/
|
|
611
|
+
readonly periodicFlush: number;
|
|
612
|
+
/**
|
|
613
|
+
* Reopen the file in place, useful for log rotation.
|
|
614
|
+
* @param file A path to a file to be written to (mode
|
|
615
|
+
* controlled by the append option).
|
|
616
|
+
*/
|
|
617
|
+
reopen(file: PathLike): void;
|
|
618
|
+
/**
|
|
619
|
+
* Whether the stream is writing synchronously or asynchronously.
|
|
620
|
+
*/
|
|
621
|
+
readonly sync: boolean;
|
|
622
|
+
/**
|
|
623
|
+
* When the `options.contentMode` is set to `'utf8'` when the stream is created,
|
|
624
|
+
* the `data` argument must be a string. If the `contentMode` is set to `'buffer'`,
|
|
625
|
+
* the `data` argument must be a `Buffer`.
|
|
626
|
+
* @param data The data to write.
|
|
627
|
+
*/
|
|
628
|
+
write(data: string | Buffer): boolean;
|
|
629
|
+
/**
|
|
630
|
+
* Whether the stream is currently writing data to the file.
|
|
631
|
+
*/
|
|
632
|
+
readonly writing: boolean;
|
|
633
|
+
/**
|
|
634
|
+
* Calls `utf8Stream.destroy()`.
|
|
635
|
+
*/
|
|
636
|
+
[Symbol.dispose](): void;
|
|
637
|
+
/**
|
|
638
|
+
* events.EventEmitter
|
|
639
|
+
* 1. change
|
|
640
|
+
* 2. close
|
|
641
|
+
* 3. error
|
|
642
|
+
*/
|
|
643
|
+
addListener(event: "close", listener: () => void): this;
|
|
644
|
+
addListener(event: "drain", listener: () => void): this;
|
|
645
|
+
addListener(event: "drop", listener: (data: string | Buffer) => void): this;
|
|
646
|
+
addListener(event: "error", listener: (error: Error) => void): this;
|
|
647
|
+
addListener(event: "finish", listener: () => void): this;
|
|
648
|
+
addListener(event: "ready", listener: () => void): this;
|
|
649
|
+
addListener(event: "write", listener: (n: number) => void): this;
|
|
650
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
|
651
|
+
on(event: "close", listener: () => void): this;
|
|
652
|
+
on(event: "drain", listener: () => void): this;
|
|
653
|
+
on(event: "drop", listener: (data: string | Buffer) => void): this;
|
|
654
|
+
on(event: "error", listener: (error: Error) => void): this;
|
|
655
|
+
on(event: "finish", listener: () => void): this;
|
|
656
|
+
on(event: "ready", listener: () => void): this;
|
|
657
|
+
on(event: "write", listener: (n: number) => void): this;
|
|
658
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
|
659
|
+
once(event: "close", listener: () => void): this;
|
|
660
|
+
once(event: "drain", listener: () => void): this;
|
|
661
|
+
once(event: "drop", listener: (data: string | Buffer) => void): this;
|
|
662
|
+
once(event: "error", listener: (error: Error) => void): this;
|
|
663
|
+
once(event: "finish", listener: () => void): this;
|
|
664
|
+
once(event: "ready", listener: () => void): this;
|
|
665
|
+
once(event: "write", listener: (n: number) => void): this;
|
|
666
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
|
667
|
+
prependListener(event: "close", listener: () => void): this;
|
|
668
|
+
prependListener(event: "drain", listener: () => void): this;
|
|
669
|
+
prependListener(event: "drop", listener: (data: string | Buffer) => void): this;
|
|
670
|
+
prependListener(event: "error", listener: (error: Error) => void): this;
|
|
671
|
+
prependListener(event: "finish", listener: () => void): this;
|
|
672
|
+
prependListener(event: "ready", listener: () => void): this;
|
|
673
|
+
prependListener(event: "write", listener: (n: number) => void): this;
|
|
674
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
|
675
|
+
prependOnceListener(event: "close", listener: () => void): this;
|
|
676
|
+
prependOnceListener(event: "drain", listener: () => void): this;
|
|
677
|
+
prependOnceListener(event: "drop", listener: (data: string | Buffer) => void): this;
|
|
678
|
+
prependOnceListener(event: "error", listener: (error: Error) => void): this;
|
|
679
|
+
prependOnceListener(event: "finish", listener: () => void): this;
|
|
680
|
+
prependOnceListener(event: "ready", listener: () => void): this;
|
|
681
|
+
prependOnceListener(event: "write", listener: (n: number) => void): this;
|
|
682
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
|
683
|
+
}
|
|
453
684
|
|
|
454
685
|
/**
|
|
455
686
|
* The Keys are events of the ReadStream and the values are the functions that are called when the event is emitted.
|
|
@@ -1326,7 +1557,7 @@ declare module "fs" {
|
|
|
1326
1557
|
export function readlink(
|
|
1327
1558
|
path: PathLike,
|
|
1328
1559
|
options: BufferEncodingOption,
|
|
1329
|
-
callback: (err: NodeJS.ErrnoException | null, linkString:
|
|
1560
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: NonSharedBuffer) => void,
|
|
1330
1561
|
): void;
|
|
1331
1562
|
/**
|
|
1332
1563
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -1336,7 +1567,7 @@ declare module "fs" {
|
|
|
1336
1567
|
export function readlink(
|
|
1337
1568
|
path: PathLike,
|
|
1338
1569
|
options: EncodingOption,
|
|
1339
|
-
callback: (err: NodeJS.ErrnoException | null, linkString: string |
|
|
1570
|
+
callback: (err: NodeJS.ErrnoException | null, linkString: string | NonSharedBuffer) => void,
|
|
1340
1571
|
): void;
|
|
1341
1572
|
/**
|
|
1342
1573
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
@@ -1358,13 +1589,13 @@ declare module "fs" {
|
|
|
1358
1589
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1359
1590
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1360
1591
|
*/
|
|
1361
|
-
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<
|
|
1592
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1362
1593
|
/**
|
|
1363
1594
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
1364
1595
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1365
1596
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1366
1597
|
*/
|
|
1367
|
-
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string |
|
|
1598
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1368
1599
|
}
|
|
1369
1600
|
/**
|
|
1370
1601
|
* Returns the symbolic link's string value.
|
|
@@ -1383,13 +1614,13 @@ declare module "fs" {
|
|
|
1383
1614
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1384
1615
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1385
1616
|
*/
|
|
1386
|
-
export function readlinkSync(path: PathLike, options: BufferEncodingOption):
|
|
1617
|
+
export function readlinkSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1387
1618
|
/**
|
|
1388
1619
|
* Synchronous readlink(2) - read value of a symbolic link.
|
|
1389
1620
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1390
1621
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1391
1622
|
*/
|
|
1392
|
-
export function readlinkSync(path: PathLike, options?: EncodingOption): string |
|
|
1623
|
+
export function readlinkSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1393
1624
|
/**
|
|
1394
1625
|
* Asynchronously computes the canonical pathname by resolving `.`, `..`, and
|
|
1395
1626
|
* symbolic links.
|
|
@@ -1429,7 +1660,7 @@ declare module "fs" {
|
|
|
1429
1660
|
export function realpath(
|
|
1430
1661
|
path: PathLike,
|
|
1431
1662
|
options: BufferEncodingOption,
|
|
1432
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath:
|
|
1663
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
|
|
1433
1664
|
): void;
|
|
1434
1665
|
/**
|
|
1435
1666
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -1439,7 +1670,7 @@ declare module "fs" {
|
|
|
1439
1670
|
export function realpath(
|
|
1440
1671
|
path: PathLike,
|
|
1441
1672
|
options: EncodingOption,
|
|
1442
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string |
|
|
1673
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
|
|
1443
1674
|
): void;
|
|
1444
1675
|
/**
|
|
1445
1676
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
@@ -1461,13 +1692,13 @@ declare module "fs" {
|
|
|
1461
1692
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1462
1693
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1463
1694
|
*/
|
|
1464
|
-
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<
|
|
1695
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1465
1696
|
/**
|
|
1466
1697
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1467
1698
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1468
1699
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1469
1700
|
*/
|
|
1470
|
-
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string |
|
|
1701
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1471
1702
|
/**
|
|
1472
1703
|
* Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html).
|
|
1473
1704
|
*
|
|
@@ -1493,12 +1724,12 @@ declare module "fs" {
|
|
|
1493
1724
|
function native(
|
|
1494
1725
|
path: PathLike,
|
|
1495
1726
|
options: BufferEncodingOption,
|
|
1496
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath:
|
|
1727
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: NonSharedBuffer) => void,
|
|
1497
1728
|
): void;
|
|
1498
1729
|
function native(
|
|
1499
1730
|
path: PathLike,
|
|
1500
1731
|
options: EncodingOption,
|
|
1501
|
-
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string |
|
|
1732
|
+
callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | NonSharedBuffer) => void,
|
|
1502
1733
|
): void;
|
|
1503
1734
|
function native(
|
|
1504
1735
|
path: PathLike,
|
|
@@ -1518,17 +1749,17 @@ declare module "fs" {
|
|
|
1518
1749
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1519
1750
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1520
1751
|
*/
|
|
1521
|
-
export function realpathSync(path: PathLike, options: BufferEncodingOption):
|
|
1752
|
+
export function realpathSync(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1522
1753
|
/**
|
|
1523
1754
|
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
|
1524
1755
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
1525
1756
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1526
1757
|
*/
|
|
1527
|
-
export function realpathSync(path: PathLike, options?: EncodingOption): string |
|
|
1758
|
+
export function realpathSync(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1528
1759
|
export namespace realpathSync {
|
|
1529
1760
|
function native(path: PathLike, options?: EncodingOption): string;
|
|
1530
|
-
function native(path: PathLike, options: BufferEncodingOption):
|
|
1531
|
-
function native(path: PathLike, options?: EncodingOption): string |
|
|
1761
|
+
function native(path: PathLike, options: BufferEncodingOption): NonSharedBuffer;
|
|
1762
|
+
function native(path: PathLike, options?: EncodingOption): string | NonSharedBuffer;
|
|
1532
1763
|
}
|
|
1533
1764
|
/**
|
|
1534
1765
|
* Asynchronously removes a file or symbolic link. No arguments other than a
|
|
@@ -1898,12 +2129,8 @@ declare module "fs" {
|
|
|
1898
2129
|
*/
|
|
1899
2130
|
export function mkdtemp(
|
|
1900
2131
|
prefix: string,
|
|
1901
|
-
options:
|
|
1902
|
-
|
|
1903
|
-
| {
|
|
1904
|
-
encoding: "buffer";
|
|
1905
|
-
},
|
|
1906
|
-
callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void,
|
|
2132
|
+
options: BufferEncodingOption,
|
|
2133
|
+
callback: (err: NodeJS.ErrnoException | null, folder: NonSharedBuffer) => void,
|
|
1907
2134
|
): void;
|
|
1908
2135
|
/**
|
|
1909
2136
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -1913,7 +2140,7 @@ declare module "fs" {
|
|
|
1913
2140
|
export function mkdtemp(
|
|
1914
2141
|
prefix: string,
|
|
1915
2142
|
options: EncodingOption,
|
|
1916
|
-
callback: (err: NodeJS.ErrnoException | null, folder: string |
|
|
2143
|
+
callback: (err: NodeJS.ErrnoException | null, folder: string | NonSharedBuffer) => void,
|
|
1917
2144
|
): void;
|
|
1918
2145
|
/**
|
|
1919
2146
|
* Asynchronously creates a unique temporary directory.
|
|
@@ -1935,13 +2162,13 @@ declare module "fs" {
|
|
|
1935
2162
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1936
2163
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1937
2164
|
*/
|
|
1938
|
-
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<
|
|
2165
|
+
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<NonSharedBuffer>;
|
|
1939
2166
|
/**
|
|
1940
2167
|
* Asynchronously creates a unique temporary directory.
|
|
1941
2168
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1942
2169
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1943
2170
|
*/
|
|
1944
|
-
function __promisify__(prefix: string, options?: EncodingOption): Promise<string |
|
|
2171
|
+
function __promisify__(prefix: string, options?: EncodingOption): Promise<string | NonSharedBuffer>;
|
|
1945
2172
|
}
|
|
1946
2173
|
/**
|
|
1947
2174
|
* Returns the created directory path.
|
|
@@ -1959,13 +2186,13 @@ declare module "fs" {
|
|
|
1959
2186
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1960
2187
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1961
2188
|
*/
|
|
1962
|
-
export function mkdtempSync(prefix: string, options: BufferEncodingOption):
|
|
2189
|
+
export function mkdtempSync(prefix: string, options: BufferEncodingOption): NonSharedBuffer;
|
|
1963
2190
|
/**
|
|
1964
2191
|
* Synchronously creates a unique temporary directory.
|
|
1965
2192
|
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
|
1966
2193
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
1967
2194
|
*/
|
|
1968
|
-
export function mkdtempSync(prefix: string, options?: EncodingOption): string |
|
|
2195
|
+
export function mkdtempSync(prefix: string, options?: EncodingOption): string | NonSharedBuffer;
|
|
1969
2196
|
export interface DisposableTempDir extends AsyncDisposable {
|
|
1970
2197
|
/**
|
|
1971
2198
|
* The path of the created directory.
|
|
@@ -2039,7 +2266,7 @@ declare module "fs" {
|
|
|
2039
2266
|
recursive?: boolean | undefined;
|
|
2040
2267
|
}
|
|
2041
2268
|
| "buffer",
|
|
2042
|
-
callback: (err: NodeJS.ErrnoException | null, files:
|
|
2269
|
+
callback: (err: NodeJS.ErrnoException | null, files: NonSharedBuffer[]) => void,
|
|
2043
2270
|
): void;
|
|
2044
2271
|
/**
|
|
2045
2272
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -2056,7 +2283,7 @@ declare module "fs" {
|
|
|
2056
2283
|
| BufferEncoding
|
|
2057
2284
|
| undefined
|
|
2058
2285
|
| null,
|
|
2059
|
-
callback: (err: NodeJS.ErrnoException | null, files: string[] |
|
|
2286
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[] | NonSharedBuffer[]) => void,
|
|
2060
2287
|
): void;
|
|
2061
2288
|
/**
|
|
2062
2289
|
* Asynchronous readdir(3) - read a directory.
|
|
@@ -2091,7 +2318,7 @@ declare module "fs" {
|
|
|
2091
2318
|
withFileTypes: true;
|
|
2092
2319
|
recursive?: boolean | undefined;
|
|
2093
2320
|
},
|
|
2094
|
-
callback: (err: NodeJS.ErrnoException | null, files: Dirent<
|
|
2321
|
+
callback: (err: NodeJS.ErrnoException | null, files: Dirent<NonSharedBuffer>[]) => void,
|
|
2095
2322
|
): void;
|
|
2096
2323
|
export namespace readdir {
|
|
2097
2324
|
/**
|
|
@@ -2124,7 +2351,7 @@ declare module "fs" {
|
|
|
2124
2351
|
withFileTypes?: false | undefined;
|
|
2125
2352
|
recursive?: boolean | undefined;
|
|
2126
2353
|
},
|
|
2127
|
-
): Promise<
|
|
2354
|
+
): Promise<NonSharedBuffer[]>;
|
|
2128
2355
|
/**
|
|
2129
2356
|
* Asynchronous readdir(3) - read a directory.
|
|
2130
2357
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2139,7 +2366,7 @@ declare module "fs" {
|
|
|
2139
2366
|
})
|
|
2140
2367
|
| BufferEncoding
|
|
2141
2368
|
| null,
|
|
2142
|
-
): Promise<string[] |
|
|
2369
|
+
): Promise<string[] | NonSharedBuffer[]>;
|
|
2143
2370
|
/**
|
|
2144
2371
|
* Asynchronous readdir(3) - read a directory.
|
|
2145
2372
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2164,7 +2391,7 @@ declare module "fs" {
|
|
|
2164
2391
|
withFileTypes: true;
|
|
2165
2392
|
recursive?: boolean | undefined;
|
|
2166
2393
|
},
|
|
2167
|
-
): Promise<Dirent<
|
|
2394
|
+
): Promise<Dirent<NonSharedBuffer>[]>;
|
|
2168
2395
|
}
|
|
2169
2396
|
/**
|
|
2170
2397
|
* Reads the contents of the directory.
|
|
@@ -2204,7 +2431,7 @@ declare module "fs" {
|
|
|
2204
2431
|
recursive?: boolean | undefined;
|
|
2205
2432
|
}
|
|
2206
2433
|
| "buffer",
|
|
2207
|
-
):
|
|
2434
|
+
): NonSharedBuffer[];
|
|
2208
2435
|
/**
|
|
2209
2436
|
* Synchronous readdir(3) - read a directory.
|
|
2210
2437
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2219,7 +2446,7 @@ declare module "fs" {
|
|
|
2219
2446
|
})
|
|
2220
2447
|
| BufferEncoding
|
|
2221
2448
|
| null,
|
|
2222
|
-
): string[] |
|
|
2449
|
+
): string[] | NonSharedBuffer[];
|
|
2223
2450
|
/**
|
|
2224
2451
|
* Synchronous readdir(3) - read a directory.
|
|
2225
2452
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -2244,7 +2471,7 @@ declare module "fs" {
|
|
|
2244
2471
|
withFileTypes: true;
|
|
2245
2472
|
recursive?: boolean | undefined;
|
|
2246
2473
|
},
|
|
2247
|
-
): Dirent<
|
|
2474
|
+
): Dirent<NonSharedBuffer>[];
|
|
2248
2475
|
/**
|
|
2249
2476
|
* Closes the file descriptor. No arguments other than a possible exception are
|
|
2250
2477
|
* given to the completion callback.
|
|
@@ -2410,7 +2637,7 @@ declare module "fs" {
|
|
|
2410
2637
|
/**
|
|
2411
2638
|
* @default null
|
|
2412
2639
|
*/
|
|
2413
|
-
position?: number |
|
|
2640
|
+
position?: number | null | undefined;
|
|
2414
2641
|
}
|
|
2415
2642
|
/**
|
|
2416
2643
|
* Write `buffer` to the file specified by `fd`.
|
|
@@ -2611,7 +2838,7 @@ declare module "fs" {
|
|
|
2611
2838
|
encoding?: BufferEncoding | null,
|
|
2612
2839
|
): number;
|
|
2613
2840
|
export type ReadPosition = number | bigint;
|
|
2614
|
-
export interface
|
|
2841
|
+
export interface ReadOptions {
|
|
2615
2842
|
/**
|
|
2616
2843
|
* @default 0
|
|
2617
2844
|
*/
|
|
@@ -2625,9 +2852,15 @@ declare module "fs" {
|
|
|
2625
2852
|
*/
|
|
2626
2853
|
position?: ReadPosition | null | undefined;
|
|
2627
2854
|
}
|
|
2628
|
-
export interface
|
|
2629
|
-
buffer?:
|
|
2855
|
+
export interface ReadOptionsWithBuffer<T extends NodeJS.ArrayBufferView> extends ReadOptions {
|
|
2856
|
+
buffer?: T | undefined;
|
|
2630
2857
|
}
|
|
2858
|
+
/** @deprecated Use `ReadOptions` instead. */
|
|
2859
|
+
// TODO: remove in future major
|
|
2860
|
+
export interface ReadSyncOptions extends ReadOptions {}
|
|
2861
|
+
/** @deprecated Use `ReadOptionsWithBuffer` instead. */
|
|
2862
|
+
// TODO: remove in future major
|
|
2863
|
+
export interface ReadAsyncOptions<T extends NodeJS.ArrayBufferView> extends ReadOptionsWithBuffer<T> {}
|
|
2631
2864
|
/**
|
|
2632
2865
|
* Read data from the file specified by `fd`.
|
|
2633
2866
|
*
|
|
@@ -2662,15 +2895,15 @@ declare module "fs" {
|
|
|
2662
2895
|
* `position` defaults to `null`
|
|
2663
2896
|
* @since v12.17.0, 13.11.0
|
|
2664
2897
|
*/
|
|
2665
|
-
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2898
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2666
2899
|
fd: number,
|
|
2667
|
-
options:
|
|
2900
|
+
options: ReadOptionsWithBuffer<TBuffer>,
|
|
2668
2901
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2669
2902
|
): void;
|
|
2670
2903
|
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2671
2904
|
fd: number,
|
|
2672
2905
|
buffer: TBuffer,
|
|
2673
|
-
options:
|
|
2906
|
+
options: ReadOptions,
|
|
2674
2907
|
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void,
|
|
2675
2908
|
): void;
|
|
2676
2909
|
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
|
@@ -2680,7 +2913,7 @@ declare module "fs" {
|
|
|
2680
2913
|
): void;
|
|
2681
2914
|
export function read(
|
|
2682
2915
|
fd: number,
|
|
2683
|
-
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer:
|
|
2916
|
+
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NonSharedBuffer) => void,
|
|
2684
2917
|
): void;
|
|
2685
2918
|
export namespace read {
|
|
2686
2919
|
/**
|
|
@@ -2700,16 +2933,16 @@ declare module "fs" {
|
|
|
2700
2933
|
bytesRead: number;
|
|
2701
2934
|
buffer: TBuffer;
|
|
2702
2935
|
}>;
|
|
2703
|
-
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
|
2936
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView = NonSharedBuffer>(
|
|
2704
2937
|
fd: number,
|
|
2705
|
-
options:
|
|
2938
|
+
options: ReadOptionsWithBuffer<TBuffer>,
|
|
2706
2939
|
): Promise<{
|
|
2707
2940
|
bytesRead: number;
|
|
2708
2941
|
buffer: TBuffer;
|
|
2709
2942
|
}>;
|
|
2710
2943
|
function __promisify__(fd: number): Promise<{
|
|
2711
2944
|
bytesRead: number;
|
|
2712
|
-
buffer:
|
|
2945
|
+
buffer: NonSharedBuffer;
|
|
2713
2946
|
}>;
|
|
2714
2947
|
}
|
|
2715
2948
|
/**
|
|
@@ -2731,7 +2964,7 @@ declare module "fs" {
|
|
|
2731
2964
|
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
|
2732
2965
|
* If no `options` object is specified, it will default with the above values.
|
|
2733
2966
|
*/
|
|
2734
|
-
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?:
|
|
2967
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadOptions): number;
|
|
2735
2968
|
/**
|
|
2736
2969
|
* Asynchronously reads the entire contents of a file.
|
|
2737
2970
|
*
|
|
@@ -3404,12 +3637,12 @@ declare module "fs" {
|
|
|
3404
3637
|
export function watch(
|
|
3405
3638
|
filename: PathLike,
|
|
3406
3639
|
options: WatchOptionsWithBufferEncoding | "buffer",
|
|
3407
|
-
listener: WatchListener<
|
|
3640
|
+
listener: WatchListener<NonSharedBuffer>,
|
|
3408
3641
|
): FSWatcher;
|
|
3409
3642
|
export function watch(
|
|
3410
3643
|
filename: PathLike,
|
|
3411
3644
|
options: WatchOptions | BufferEncoding | "buffer" | null,
|
|
3412
|
-
listener: WatchListener<string |
|
|
3645
|
+
listener: WatchListener<string | NonSharedBuffer>,
|
|
3413
3646
|
): FSWatcher;
|
|
3414
3647
|
export function watch(filename: PathLike, listener: WatchListener<string>): FSWatcher;
|
|
3415
3648
|
/**
|
|
@@ -4120,27 +4353,29 @@ declare module "fs" {
|
|
|
4120
4353
|
* @since v12.9.0
|
|
4121
4354
|
* @param [position='null']
|
|
4122
4355
|
*/
|
|
4123
|
-
export function writev(
|
|
4356
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4124
4357
|
fd: number,
|
|
4125
|
-
buffers:
|
|
4126
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers:
|
|
4358
|
+
buffers: TBuffers,
|
|
4359
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
|
|
4127
4360
|
): void;
|
|
4128
|
-
export function writev(
|
|
4361
|
+
export function writev<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4129
4362
|
fd: number,
|
|
4130
|
-
buffers:
|
|
4363
|
+
buffers: TBuffers,
|
|
4131
4364
|
position: number | null,
|
|
4132
|
-
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers:
|
|
4365
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: TBuffers) => void,
|
|
4133
4366
|
): void;
|
|
4134
|
-
|
|
4367
|
+
// Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
|
|
4368
|
+
// TODO: remove default in future major version
|
|
4369
|
+
export interface WriteVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4135
4370
|
bytesWritten: number;
|
|
4136
|
-
buffers:
|
|
4371
|
+
buffers: T;
|
|
4137
4372
|
}
|
|
4138
4373
|
export namespace writev {
|
|
4139
|
-
function __promisify__(
|
|
4374
|
+
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4140
4375
|
fd: number,
|
|
4141
|
-
buffers:
|
|
4376
|
+
buffers: TBuffers,
|
|
4142
4377
|
position?: number,
|
|
4143
|
-
): Promise<WriteVResult
|
|
4378
|
+
): Promise<WriteVResult<TBuffers>>;
|
|
4144
4379
|
}
|
|
4145
4380
|
/**
|
|
4146
4381
|
* For detailed information, see the documentation of the asynchronous version of
|
|
@@ -4165,27 +4400,29 @@ declare module "fs" {
|
|
|
4165
4400
|
* @since v13.13.0, v12.17.0
|
|
4166
4401
|
* @param [position='null']
|
|
4167
4402
|
*/
|
|
4168
|
-
export function readv(
|
|
4403
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4169
4404
|
fd: number,
|
|
4170
|
-
buffers:
|
|
4171
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers:
|
|
4405
|
+
buffers: TBuffers,
|
|
4406
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
|
|
4172
4407
|
): void;
|
|
4173
|
-
export function readv(
|
|
4408
|
+
export function readv<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4174
4409
|
fd: number,
|
|
4175
|
-
buffers:
|
|
4410
|
+
buffers: TBuffers,
|
|
4176
4411
|
position: number | null,
|
|
4177
|
-
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers:
|
|
4412
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: TBuffers) => void,
|
|
4178
4413
|
): void;
|
|
4179
|
-
|
|
4414
|
+
// Providing a default type parameter doesn't provide true BC for userland consumers, but at least suppresses TS2314
|
|
4415
|
+
// TODO: remove default in future major version
|
|
4416
|
+
export interface ReadVResult<T extends readonly NodeJS.ArrayBufferView[] = NodeJS.ArrayBufferView[]> {
|
|
4180
4417
|
bytesRead: number;
|
|
4181
|
-
buffers:
|
|
4418
|
+
buffers: T;
|
|
4182
4419
|
}
|
|
4183
4420
|
export namespace readv {
|
|
4184
|
-
function __promisify__(
|
|
4421
|
+
function __promisify__<TBuffers extends readonly NodeJS.ArrayBufferView[]>(
|
|
4185
4422
|
fd: number,
|
|
4186
|
-
buffers:
|
|
4423
|
+
buffers: TBuffers,
|
|
4187
4424
|
position?: number,
|
|
4188
|
-
): Promise<ReadVResult
|
|
4425
|
+
): Promise<ReadVResult<TBuffers>>;
|
|
4189
4426
|
}
|
|
4190
4427
|
/**
|
|
4191
4428
|
* For detailed information, see the documentation of the asynchronous version of
|
|
@@ -4239,7 +4476,7 @@ declare module "fs" {
|
|
|
4239
4476
|
/**
|
|
4240
4477
|
* @default false
|
|
4241
4478
|
*/
|
|
4242
|
-
recursive?: boolean;
|
|
4479
|
+
recursive?: boolean | undefined;
|
|
4243
4480
|
}
|
|
4244
4481
|
/**
|
|
4245
4482
|
* Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html).
|
|
@@ -4292,54 +4529,54 @@ declare module "fs" {
|
|
|
4292
4529
|
* Dereference symlinks
|
|
4293
4530
|
* @default false
|
|
4294
4531
|
*/
|
|
4295
|
-
dereference?: boolean;
|
|
4532
|
+
dereference?: boolean | undefined;
|
|
4296
4533
|
/**
|
|
4297
4534
|
* When `force` is `false`, and the destination
|
|
4298
4535
|
* exists, throw an error.
|
|
4299
4536
|
* @default false
|
|
4300
4537
|
*/
|
|
4301
|
-
errorOnExist?: boolean;
|
|
4538
|
+
errorOnExist?: boolean | undefined;
|
|
4302
4539
|
/**
|
|
4303
4540
|
* Overwrite existing file or directory. _The copy
|
|
4304
4541
|
* operation will ignore errors if you set this to false and the destination
|
|
4305
4542
|
* exists. Use the `errorOnExist` option to change this behavior.
|
|
4306
4543
|
* @default true
|
|
4307
4544
|
*/
|
|
4308
|
-
force?: boolean;
|
|
4545
|
+
force?: boolean | undefined;
|
|
4309
4546
|
/**
|
|
4310
4547
|
* Modifiers for copy operation. See `mode` flag of {@link copyFileSync()}
|
|
4311
4548
|
*/
|
|
4312
|
-
mode?: number;
|
|
4549
|
+
mode?: number | undefined;
|
|
4313
4550
|
/**
|
|
4314
4551
|
* When `true` timestamps from `src` will
|
|
4315
4552
|
* be preserved.
|
|
4316
4553
|
* @default false
|
|
4317
4554
|
*/
|
|
4318
|
-
preserveTimestamps?: boolean;
|
|
4555
|
+
preserveTimestamps?: boolean | undefined;
|
|
4319
4556
|
/**
|
|
4320
4557
|
* Copy directories recursively.
|
|
4321
4558
|
* @default false
|
|
4322
4559
|
*/
|
|
4323
|
-
recursive?: boolean;
|
|
4560
|
+
recursive?: boolean | undefined;
|
|
4324
4561
|
/**
|
|
4325
4562
|
* When true, path resolution for symlinks will be skipped
|
|
4326
4563
|
* @default false
|
|
4327
4564
|
*/
|
|
4328
|
-
verbatimSymlinks?: boolean;
|
|
4565
|
+
verbatimSymlinks?: boolean | undefined;
|
|
4329
4566
|
}
|
|
4330
4567
|
export interface CopyOptions extends CopyOptionsBase {
|
|
4331
4568
|
/**
|
|
4332
4569
|
* Function to filter copied files/directories. Return
|
|
4333
4570
|
* `true` to copy the item, `false` to ignore it.
|
|
4334
4571
|
*/
|
|
4335
|
-
filter
|
|
4572
|
+
filter?: ((source: string, destination: string) => boolean | Promise<boolean>) | undefined;
|
|
4336
4573
|
}
|
|
4337
4574
|
export interface CopySyncOptions extends CopyOptionsBase {
|
|
4338
4575
|
/**
|
|
4339
4576
|
* Function to filter copied files/directories. Return
|
|
4340
4577
|
* `true` to copy the item, `false` to ignore it.
|
|
4341
4578
|
*/
|
|
4342
|
-
filter
|
|
4579
|
+
filter?: ((source: string, destination: string) => boolean) | undefined;
|
|
4343
4580
|
}
|
|
4344
4581
|
/**
|
|
4345
4582
|
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
|
@@ -4376,6 +4613,7 @@ declare module "fs" {
|
|
|
4376
4613
|
*/
|
|
4377
4614
|
export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void;
|
|
4378
4615
|
|
|
4616
|
+
// TODO: collapse
|
|
4379
4617
|
interface _GlobOptions<T extends Dirent | string> {
|
|
4380
4618
|
/**
|
|
4381
4619
|
* Current working directory.
|
|
@@ -4392,6 +4630,9 @@ declare module "fs" {
|
|
|
4392
4630
|
* Function to filter out files/directories or a
|
|
4393
4631
|
* list of glob patterns to be excluded. If a function is provided, return
|
|
4394
4632
|
* `true` to exclude the item, `false` to include it.
|
|
4633
|
+
* If a string array is provided, each string should be a glob pattern that
|
|
4634
|
+
* specifies paths to exclude. Note: Negation patterns (e.g., '!foo.js') are
|
|
4635
|
+
* not supported.
|
|
4395
4636
|
* @default undefined
|
|
4396
4637
|
*/
|
|
4397
4638
|
exclude?: ((fileName: T) => boolean) | readonly string[] | undefined;
|