cloudstructs 0.1.38 → 0.1.42
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/.gitattributes +19 -19
- package/.jsii +75 -31
- package/lib/codecommit-mirror/index.js +2 -2
- package/lib/ecs-service-roller/index.js +2 -2
- package/lib/email-receiver/receiver.js +1 -1
- package/lib/saml-identity-provider/index.js +2 -2
- package/lib/slack-events/index.js +1 -1
- package/lib/slack-textract/index.js +1 -1
- package/lib/state-machine-cr-provider/index.js +1 -1
- package/lib/static-website/index.js +1 -1
- package/lib/url-shortener/index.handler.js +2 -1
- package/lib/url-shortener/index.js +1 -1
- package/node_modules/@sindresorhus/is/dist/index.d.ts +9 -4
- package/node_modules/@sindresorhus/is/dist/index.js +9 -0
- package/node_modules/@sindresorhus/is/package.json +1 -1
- package/node_modules/@sindresorhus/is/readme.md +26 -0
- package/node_modules/@slack/logger/node_modules/@types/node/README.md +3 -3
- package/node_modules/@slack/logger/node_modules/@types/node/assert/strict.d.ts +0 -1
- package/node_modules/@slack/logger/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@slack/logger/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@slack/logger/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@slack/logger/node_modules/@types/node/child_process.d.ts +1080 -247
- package/node_modules/@slack/logger/node_modules/@types/node/cluster.d.ts +327 -101
- package/node_modules/@slack/logger/node_modules/@types/node/console.d.ts +310 -32
- package/node_modules/@slack/logger/node_modules/@types/node/crypto.d.ts +2454 -742
- package/node_modules/@slack/logger/node_modules/@types/node/dgram.d.ts +463 -63
- package/node_modules/@slack/logger/node_modules/@types/node/diagnostics_channel.d.ts +109 -13
- package/node_modules/@slack/logger/node_modules/@types/node/dns/promises.d.ts +303 -36
- package/node_modules/@slack/logger/node_modules/@types/node/dns.d.ts +425 -97
- package/node_modules/@slack/logger/node_modules/@types/node/domain.d.ts +154 -10
- package/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +559 -34
- package/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +812 -269
- package/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +2408 -874
- package/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +1031 -98
- package/node_modules/@slack/logger/node_modules/@types/node/http2.d.ts +1579 -459
- package/node_modules/@slack/logger/node_modules/@types/node/https.d.ts +363 -12
- package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +88 -15
- package/node_modules/@slack/logger/node_modules/@types/node/inspector.d.ts +360 -661
- package/node_modules/@slack/logger/node_modules/@types/node/module.d.ts +52 -11
- package/node_modules/@slack/logger/node_modules/@types/node/net.d.ts +557 -142
- package/node_modules/@slack/logger/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@slack/logger/node_modules/@types/node/package.json +23 -25
- package/node_modules/@slack/logger/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@slack/logger/node_modules/@types/node/perf_hooks.d.ts +289 -91
- package/node_modules/@slack/logger/node_modules/@types/node/process.d.ts +1173 -155
- package/node_modules/@slack/logger/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@slack/logger/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@slack/logger/node_modules/@types/node/readline.d.ts +426 -79
- package/node_modules/@slack/logger/node_modules/@types/node/repl.d.ts +135 -110
- package/node_modules/@slack/logger/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@slack/logger/node_modules/@types/node/stream/promises.d.ts +15 -44
- package/node_modules/@slack/logger/node_modules/@types/node/stream/web.d.ts +391 -0
- package/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +998 -225
- package/node_modules/@slack/logger/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@slack/logger/node_modules/@types/node/timers/promises.d.ts +52 -9
- package/node_modules/@slack/logger/node_modules/@types/node/timers.d.ts +30 -11
- package/node_modules/@slack/logger/node_modules/@types/node/tls.d.ts +447 -225
- package/node_modules/@slack/logger/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@slack/logger/node_modules/@types/node/tty.d.ts +157 -23
- package/node_modules/@slack/logger/node_modules/@types/node/url.d.ts +724 -30
- package/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +1399 -73
- package/node_modules/@slack/logger/node_modules/@types/node/v8.d.ts +254 -78
- package/node_modules/@slack/logger/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@slack/logger/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +494 -131
- package/node_modules/@slack/logger/node_modules/@types/node/zlib.d.ts +215 -63
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +3 -3
- package/node_modules/@slack/web-api/node_modules/@types/node/assert/strict.d.ts +0 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@slack/web-api/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@slack/web-api/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +1080 -247
- package/node_modules/@slack/web-api/node_modules/@types/node/cluster.d.ts +327 -101
- package/node_modules/@slack/web-api/node_modules/@types/node/console.d.ts +310 -32
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +2454 -742
- package/node_modules/@slack/web-api/node_modules/@types/node/dgram.d.ts +463 -63
- package/node_modules/@slack/web-api/node_modules/@types/node/diagnostics_channel.d.ts +109 -13
- package/node_modules/@slack/web-api/node_modules/@types/node/dns/promises.d.ts +303 -36
- package/node_modules/@slack/web-api/node_modules/@types/node/dns.d.ts +425 -97
- package/node_modules/@slack/web-api/node_modules/@types/node/domain.d.ts +154 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/events.d.ts +559 -34
- package/node_modules/@slack/web-api/node_modules/@types/node/fs/promises.d.ts +812 -269
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +2408 -874
- package/node_modules/@slack/web-api/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +1031 -98
- package/node_modules/@slack/web-api/node_modules/@types/node/http2.d.ts +1579 -459
- package/node_modules/@slack/web-api/node_modules/@types/node/https.d.ts +363 -12
- package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +88 -15
- package/node_modules/@slack/web-api/node_modules/@types/node/inspector.d.ts +360 -661
- package/node_modules/@slack/web-api/node_modules/@types/node/module.d.ts +52 -11
- package/node_modules/@slack/web-api/node_modules/@types/node/net.d.ts +557 -142
- package/node_modules/@slack/web-api/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +23 -25
- package/node_modules/@slack/web-api/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +289 -91
- package/node_modules/@slack/web-api/node_modules/@types/node/process.d.ts +1173 -155
- package/node_modules/@slack/web-api/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@slack/web-api/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@slack/web-api/node_modules/@types/node/readline.d.ts +426 -79
- package/node_modules/@slack/web-api/node_modules/@types/node/repl.d.ts +135 -110
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/promises.d.ts +15 -44
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/web.d.ts +391 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/stream.d.ts +998 -225
- package/node_modules/@slack/web-api/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/timers/promises.d.ts +52 -9
- package/node_modules/@slack/web-api/node_modules/@types/node/timers.d.ts +30 -11
- package/node_modules/@slack/web-api/node_modules/@types/node/tls.d.ts +447 -225
- package/node_modules/@slack/web-api/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@slack/web-api/node_modules/@types/node/tty.d.ts +157 -23
- package/node_modules/@slack/web-api/node_modules/@types/node/url.d.ts +724 -30
- package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +1399 -73
- package/node_modules/@slack/web-api/node_modules/@types/node/v8.d.ts +254 -78
- package/node_modules/@slack/web-api/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@slack/web-api/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +494 -131
- package/node_modules/@slack/web-api/node_modules/@types/node/zlib.d.ts +215 -63
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert/strict.d.ts +0 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@types/cacheable-request/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@types/cacheable-request/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +1080 -247
- package/node_modules/@types/cacheable-request/node_modules/@types/node/cluster.d.ts +327 -101
- package/node_modules/@types/cacheable-request/node_modules/@types/node/console.d.ts +310 -32
- package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +2454 -742
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dgram.d.ts +463 -63
- package/node_modules/@types/cacheable-request/node_modules/@types/node/diagnostics_channel.d.ts +109 -13
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns/promises.d.ts +303 -36
- package/node_modules/@types/cacheable-request/node_modules/@types/node/dns.d.ts +425 -97
- package/node_modules/@types/cacheable-request/node_modules/@types/node/domain.d.ts +154 -10
- package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +559 -34
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +812 -269
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +2408 -874
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +1031 -98
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http2.d.ts +1579 -459
- package/node_modules/@types/cacheable-request/node_modules/@types/node/https.d.ts +363 -12
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +88 -15
- package/node_modules/@types/cacheable-request/node_modules/@types/node/inspector.d.ts +360 -661
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +52 -11
- package/node_modules/@types/cacheable-request/node_modules/@types/node/net.d.ts +557 -142
- package/node_modules/@types/cacheable-request/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +23 -25
- package/node_modules/@types/cacheable-request/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +289 -91
- package/node_modules/@types/cacheable-request/node_modules/@types/node/process.d.ts +1173 -155
- package/node_modules/@types/cacheable-request/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@types/cacheable-request/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +426 -79
- package/node_modules/@types/cacheable-request/node_modules/@types/node/repl.d.ts +135 -110
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +15 -44
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +391 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +998 -225
- package/node_modules/@types/cacheable-request/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +52 -9
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers.d.ts +30 -11
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +447 -225
- package/node_modules/@types/cacheable-request/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tty.d.ts +157 -23
- package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +724 -30
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +1399 -73
- package/node_modules/@types/cacheable-request/node_modules/@types/node/v8.d.ts +254 -78
- package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@types/cacheable-request/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +494 -131
- package/node_modules/@types/cacheable-request/node_modules/@types/node/zlib.d.ts +215 -63
- package/node_modules/@types/is-stream/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/is-stream/node_modules/@types/node/assert/strict.d.ts +0 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@types/is-stream/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@types/is-stream/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@types/is-stream/node_modules/@types/node/child_process.d.ts +1080 -247
- package/node_modules/@types/is-stream/node_modules/@types/node/cluster.d.ts +327 -101
- package/node_modules/@types/is-stream/node_modules/@types/node/console.d.ts +310 -32
- package/node_modules/@types/is-stream/node_modules/@types/node/crypto.d.ts +2454 -742
- package/node_modules/@types/is-stream/node_modules/@types/node/dgram.d.ts +463 -63
- package/node_modules/@types/is-stream/node_modules/@types/node/diagnostics_channel.d.ts +109 -13
- package/node_modules/@types/is-stream/node_modules/@types/node/dns/promises.d.ts +303 -36
- package/node_modules/@types/is-stream/node_modules/@types/node/dns.d.ts +425 -97
- package/node_modules/@types/is-stream/node_modules/@types/node/domain.d.ts +154 -10
- package/node_modules/@types/is-stream/node_modules/@types/node/events.d.ts +559 -34
- package/node_modules/@types/is-stream/node_modules/@types/node/fs/promises.d.ts +812 -269
- package/node_modules/@types/is-stream/node_modules/@types/node/fs.d.ts +2408 -874
- package/node_modules/@types/is-stream/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@types/is-stream/node_modules/@types/node/http.d.ts +1031 -98
- package/node_modules/@types/is-stream/node_modules/@types/node/http2.d.ts +1579 -459
- package/node_modules/@types/is-stream/node_modules/@types/node/https.d.ts +363 -12
- package/node_modules/@types/is-stream/node_modules/@types/node/index.d.ts +88 -15
- package/node_modules/@types/is-stream/node_modules/@types/node/inspector.d.ts +360 -661
- package/node_modules/@types/is-stream/node_modules/@types/node/module.d.ts +52 -11
- package/node_modules/@types/is-stream/node_modules/@types/node/net.d.ts +557 -142
- package/node_modules/@types/is-stream/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@types/is-stream/node_modules/@types/node/package.json +23 -25
- package/node_modules/@types/is-stream/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@types/is-stream/node_modules/@types/node/perf_hooks.d.ts +289 -91
- package/node_modules/@types/is-stream/node_modules/@types/node/process.d.ts +1173 -155
- package/node_modules/@types/is-stream/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@types/is-stream/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@types/is-stream/node_modules/@types/node/readline.d.ts +426 -79
- package/node_modules/@types/is-stream/node_modules/@types/node/repl.d.ts +135 -110
- package/node_modules/@types/is-stream/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/stream/promises.d.ts +15 -44
- package/node_modules/@types/is-stream/node_modules/@types/node/stream/web.d.ts +391 -0
- package/node_modules/@types/is-stream/node_modules/@types/node/stream.d.ts +998 -225
- package/node_modules/@types/is-stream/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/timers/promises.d.ts +52 -9
- package/node_modules/@types/is-stream/node_modules/@types/node/timers.d.ts +30 -11
- package/node_modules/@types/is-stream/node_modules/@types/node/tls.d.ts +447 -225
- package/node_modules/@types/is-stream/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@types/is-stream/node_modules/@types/node/tty.d.ts +157 -23
- package/node_modules/@types/is-stream/node_modules/@types/node/url.d.ts +724 -30
- package/node_modules/@types/is-stream/node_modules/@types/node/util.d.ts +1399 -73
- package/node_modules/@types/is-stream/node_modules/@types/node/v8.d.ts +254 -78
- package/node_modules/@types/is-stream/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@types/is-stream/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@types/is-stream/node_modules/@types/node/worker_threads.d.ts +494 -131
- package/node_modules/@types/is-stream/node_modules/@types/node/zlib.d.ts +215 -63
- package/node_modules/@types/keyv/README.md +1 -1
- package/node_modules/@types/keyv/index.d.ts +10 -3
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/keyv/node_modules/@types/node/assert/strict.d.ts +0 -1
- package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@types/keyv/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@types/keyv/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1080 -247
- package/node_modules/@types/keyv/node_modules/@types/node/cluster.d.ts +327 -101
- package/node_modules/@types/keyv/node_modules/@types/node/console.d.ts +310 -32
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +2454 -742
- package/node_modules/@types/keyv/node_modules/@types/node/dgram.d.ts +463 -63
- package/node_modules/@types/keyv/node_modules/@types/node/diagnostics_channel.d.ts +109 -13
- package/node_modules/@types/keyv/node_modules/@types/node/dns/promises.d.ts +303 -36
- package/node_modules/@types/keyv/node_modules/@types/node/dns.d.ts +425 -97
- package/node_modules/@types/keyv/node_modules/@types/node/domain.d.ts +154 -10
- package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +559 -34
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +812 -269
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +2408 -874
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +1031 -98
- package/node_modules/@types/keyv/node_modules/@types/node/http2.d.ts +1579 -459
- package/node_modules/@types/keyv/node_modules/@types/node/https.d.ts +363 -12
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +88 -15
- package/node_modules/@types/keyv/node_modules/@types/node/inspector.d.ts +360 -661
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +52 -11
- package/node_modules/@types/keyv/node_modules/@types/node/net.d.ts +557 -142
- package/node_modules/@types/keyv/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +23 -25
- package/node_modules/@types/keyv/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +289 -91
- package/node_modules/@types/keyv/node_modules/@types/node/process.d.ts +1173 -155
- package/node_modules/@types/keyv/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@types/keyv/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +426 -79
- package/node_modules/@types/keyv/node_modules/@types/node/repl.d.ts +135 -110
- package/node_modules/@types/keyv/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +15 -44
- package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +391 -0
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +998 -225
- package/node_modules/@types/keyv/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +52 -9
- package/node_modules/@types/keyv/node_modules/@types/node/timers.d.ts +30 -11
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +447 -225
- package/node_modules/@types/keyv/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@types/keyv/node_modules/@types/node/tty.d.ts +157 -23
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +724 -30
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +1399 -73
- package/node_modules/@types/keyv/node_modules/@types/node/v8.d.ts +254 -78
- package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@types/keyv/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +494 -131
- package/node_modules/@types/keyv/node_modules/@types/node/zlib.d.ts +215 -63
- package/node_modules/@types/keyv/package.json +3 -3
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +3 -3
- package/node_modules/@types/responselike/node_modules/@types/node/assert/strict.d.ts +0 -1
- package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +823 -40
- package/node_modules/@types/responselike/node_modules/@types/node/async_hooks.d.ts +359 -90
- package/node_modules/@types/responselike/node_modules/@types/node/buffer.d.ts +1895 -113
- package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +1080 -247
- package/node_modules/@types/responselike/node_modules/@types/node/cluster.d.ts +327 -101
- package/node_modules/@types/responselike/node_modules/@types/node/console.d.ts +310 -32
- package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +2454 -742
- package/node_modules/@types/responselike/node_modules/@types/node/dgram.d.ts +463 -63
- package/node_modules/@types/responselike/node_modules/@types/node/diagnostics_channel.d.ts +109 -13
- package/node_modules/@types/responselike/node_modules/@types/node/dns/promises.d.ts +303 -36
- package/node_modules/@types/responselike/node_modules/@types/node/dns.d.ts +425 -97
- package/node_modules/@types/responselike/node_modules/@types/node/domain.d.ts +154 -10
- package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +559 -34
- package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +812 -269
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +2408 -874
- package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +24 -14
- package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +1031 -98
- package/node_modules/@types/responselike/node_modules/@types/node/http2.d.ts +1579 -459
- package/node_modules/@types/responselike/node_modules/@types/node/https.d.ts +363 -12
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +88 -15
- package/node_modules/@types/responselike/node_modules/@types/node/inspector.d.ts +360 -661
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +52 -11
- package/node_modules/@types/responselike/node_modules/@types/node/net.d.ts +557 -142
- package/node_modules/@types/responselike/node_modules/@types/node/os.d.ts +236 -26
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +23 -25
- package/node_modules/@types/responselike/node_modules/@types/node/path.d.ts +9 -5
- package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +289 -91
- package/node_modules/@types/responselike/node_modules/@types/node/process.d.ts +1173 -155
- package/node_modules/@types/responselike/node_modules/@types/node/punycode.d.ts +64 -26
- package/node_modules/@types/responselike/node_modules/@types/node/querystring.d.ts +107 -8
- package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +426 -79
- package/node_modules/@types/responselike/node_modules/@types/node/repl.d.ts +135 -110
- package/node_modules/@types/responselike/node_modules/@types/node/stream/consumers.d.ts +24 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +15 -44
- package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +391 -0
- package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +998 -225
- package/node_modules/@types/responselike/node_modules/@types/node/string_decoder.d.ts +57 -1
- package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +52 -9
- package/node_modules/@types/responselike/node_modules/@types/node/timers.d.ts +30 -11
- package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +447 -225
- package/node_modules/@types/responselike/node_modules/@types/node/trace_events.d.ts +107 -11
- package/node_modules/@types/responselike/node_modules/@types/node/tty.d.ts +157 -23
- package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +724 -30
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +1399 -73
- package/node_modules/@types/responselike/node_modules/@types/node/v8.d.ts +254 -78
- package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +384 -33
- package/node_modules/@types/responselike/node_modules/@types/node/wasi.d.ts +92 -24
- package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +494 -131
- package/node_modules/@types/responselike/node_modules/@types/node/zlib.d.ts +215 -63
- package/node_modules/axios/CHANGELOG.md +98 -8
- package/node_modules/axios/README.md +74 -6
- package/node_modules/axios/SECURITY.md +5 -0
- package/node_modules/axios/dist/axios.js +2028 -1591
- package/node_modules/axios/dist/axios.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.map +1 -1
- package/node_modules/axios/index.d.ts +8 -1
- package/node_modules/axios/lib/adapters/http.js +33 -5
- package/node_modules/axios/lib/adapters/xhr.js +35 -25
- package/node_modules/axios/lib/core/Axios.js +60 -7
- package/node_modules/axios/lib/core/InterceptorManager.js +4 -2
- package/node_modules/axios/lib/core/README.md +1 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +6 -3
- package/node_modules/axios/lib/core/transformData.js +3 -1
- package/node_modules/axios/lib/defaults.js +43 -7
- package/node_modules/axios/lib/helpers/validator.js +105 -0
- package/node_modules/axios/lib/utils.js +1 -3
- package/node_modules/axios/package.json +19 -21
- package/node_modules/follow-redirects/debug.js +2 -1
- package/node_modules/follow-redirects/index.js +59 -21
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/got/dist/source/as-promise/parse-body.d.ts +1 -1
- package/node_modules/got/dist/source/as-promise/types.js +2 -0
- package/node_modules/got/dist/source/core/index.d.ts +1 -1
- package/node_modules/got/dist/source/core/index.js +9 -3
- package/node_modules/got/dist/source/types.d.ts +14 -12
- package/node_modules/got/package.json +2 -2
- package/node_modules/got/readme.md +11 -10
- package/node_modules/keyv/LICENSE +1 -1
- package/node_modules/keyv/README.md +12 -10
- package/node_modules/keyv/package.json +17 -12
- package/node_modules/keyv/src/index.js +14 -16
- package/node_modules/mime-db/HISTORY.md +19 -0
- package/node_modules/mime-db/db.json +93 -1
- package/node_modules/mime-db/package.json +7 -7
- package/node_modules/mime-types/HISTORY.md +20 -3
- package/node_modules/mime-types/package.json +7 -7
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/index.d.ts +0 -0
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/index.js +0 -0
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/license +0 -0
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/package.json +0 -0
- package/node_modules/{http2-wrapper/node_modules/quick-lru → quick-lru}/readme.md +0 -0
- package/node_modules/resolve-alpn/README.md +8 -1
- package/node_modules/resolve-alpn/index.js +14 -4
- package/node_modules/resolve-alpn/package.json +1 -1
- package/package.json +33 -34
- package/node_modules/@slack/logger/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@slack/logger/node_modules/@types/node/ts3.6/assert.d.ts +0 -103
- package/node_modules/@slack/logger/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@slack/logger/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@slack/web-api/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@slack/web-api/node_modules/@types/node/ts3.6/assert.d.ts +0 -103
- package/node_modules/@slack/web-api/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@slack/web-api/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@types/cacheable-request/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts3.6/assert.d.ts +0 -103
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@types/is-stream/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@types/is-stream/node_modules/@types/node/ts3.6/assert.d.ts +0 -103
- package/node_modules/@types/is-stream/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@types/is-stream/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@types/keyv/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@types/keyv/node_modules/@types/node/ts3.6/assert.d.ts +0 -103
- package/node_modules/@types/keyv/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@types/keyv/node_modules/@types/node/ts3.6/index.d.ts +0 -7
- package/node_modules/@types/responselike/node_modules/@types/node/base.d.ts +0 -19
- package/node_modules/@types/responselike/node_modules/@types/node/ts3.6/assert.d.ts +0 -103
- package/node_modules/@types/responselike/node_modules/@types/node/ts3.6/base.d.ts +0 -67
- package/node_modules/@types/responselike/node_modules/@types/node/ts3.6/index.d.ts +0 -7
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `fs/promises` API provides asynchronous file system methods that return
|
|
3
|
+
* promises.
|
|
4
|
+
*
|
|
5
|
+
* The promise APIs use the underlying Node.js threadpool to perform file
|
|
6
|
+
* system operations off the event loop thread. These operations are not
|
|
7
|
+
* synchronized or threadsafe. Care must be taken when performing multiple
|
|
8
|
+
* concurrent modifications on the same file or data corruption may occur.
|
|
9
|
+
* @since v10.0.0
|
|
10
|
+
*/
|
|
1
11
|
declare module 'fs/promises' {
|
|
2
12
|
import { Abortable } from 'node:events';
|
|
3
13
|
import { Stream } from 'node:stream';
|
|
@@ -19,18 +29,23 @@ declare module 'fs/promises' {
|
|
|
19
29
|
OpenMode,
|
|
20
30
|
Mode,
|
|
21
31
|
WatchOptions,
|
|
32
|
+
WatchEventType,
|
|
33
|
+
CopyOptions,
|
|
34
|
+
ReadStream,
|
|
35
|
+
WriteStream,
|
|
22
36
|
} from 'node:fs';
|
|
23
|
-
|
|
37
|
+
interface FileChangeInfo<T extends string | Buffer> {
|
|
38
|
+
eventType: WatchEventType;
|
|
39
|
+
filename: T;
|
|
40
|
+
}
|
|
24
41
|
interface FlagAndOpenMode {
|
|
25
42
|
mode?: Mode | undefined;
|
|
26
43
|
flag?: OpenMode | undefined;
|
|
27
44
|
}
|
|
28
|
-
|
|
29
45
|
interface FileReadResult<T extends ArrayBufferView> {
|
|
30
46
|
bytesRead: number;
|
|
31
47
|
buffer: T;
|
|
32
48
|
}
|
|
33
|
-
|
|
34
49
|
interface FileReadOptions<T extends ArrayBufferView = Buffer> {
|
|
35
50
|
/**
|
|
36
51
|
* @default `Buffer.alloc(0xffff)`
|
|
@@ -46,222 +61,494 @@ declare module 'fs/promises' {
|
|
|
46
61
|
length?: number | null;
|
|
47
62
|
position?: number | null;
|
|
48
63
|
}
|
|
49
|
-
|
|
64
|
+
interface CreateReadStreamOptions {
|
|
65
|
+
encoding?: BufferEncoding | null | undefined;
|
|
66
|
+
autoClose?: boolean | undefined;
|
|
67
|
+
emitClose?: boolean | undefined;
|
|
68
|
+
start?: number | undefined;
|
|
69
|
+
end?: number | undefined;
|
|
70
|
+
highWaterMark?: number | undefined;
|
|
71
|
+
}
|
|
72
|
+
interface CreateWriteStreamOptions {
|
|
73
|
+
encoding?: BufferEncoding | null | undefined;
|
|
74
|
+
autoClose?: boolean | undefined;
|
|
75
|
+
emitClose?: boolean | undefined;
|
|
76
|
+
start?: number | undefined;
|
|
77
|
+
}
|
|
50
78
|
// TODO: Add `EventEmitter` close
|
|
51
79
|
interface FileHandle {
|
|
52
80
|
/**
|
|
53
|
-
*
|
|
81
|
+
* The numeric file descriptor managed by the {FileHandle} object.
|
|
82
|
+
* @since v10.0.0
|
|
54
83
|
*/
|
|
55
84
|
readonly fd: number;
|
|
56
|
-
|
|
57
85
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* If `mode` is a string, it is parsed as an octal integer.
|
|
65
|
-
* If `flag` is not supplied, the default of `'a'` is used.
|
|
86
|
+
* Alias of `filehandle.writeFile()`.
|
|
87
|
+
*
|
|
88
|
+
* When operating on file handles, the mode cannot be changed from what it was set
|
|
89
|
+
* to with `fsPromises.open()`. Therefore, this is equivalent to `filehandle.writeFile()`.
|
|
90
|
+
* @since v10.0.0
|
|
91
|
+
* @return Fulfills with `undefined` upon success.
|
|
66
92
|
*/
|
|
67
|
-
appendFile(data: string | Uint8Array, options?: ObjectEncodingOptions & FlagAndOpenMode | BufferEncoding | null): Promise<void>;
|
|
68
|
-
|
|
93
|
+
appendFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise<void>;
|
|
69
94
|
/**
|
|
70
|
-
*
|
|
95
|
+
* Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html).
|
|
96
|
+
* @since v10.0.0
|
|
97
|
+
* @param uid The file's new owner's user id.
|
|
98
|
+
* @param gid The file's new group's group id.
|
|
99
|
+
* @return Fulfills with `undefined` upon success.
|
|
71
100
|
*/
|
|
72
101
|
chown(uid: number, gid: number): Promise<void>;
|
|
73
|
-
|
|
74
102
|
/**
|
|
75
|
-
*
|
|
76
|
-
* @
|
|
103
|
+
* Modifies the permissions on the file. See [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html).
|
|
104
|
+
* @since v10.0.0
|
|
105
|
+
* @param mode the file mode bit mask.
|
|
106
|
+
* @return Fulfills with `undefined` upon success.
|
|
77
107
|
*/
|
|
78
108
|
chmod(mode: Mode): Promise<void>;
|
|
79
|
-
|
|
80
109
|
/**
|
|
81
|
-
*
|
|
110
|
+
* Unlike the 16 kb default `highWaterMark` for a `stream.Readable`, the stream
|
|
111
|
+
* returned by this method has a default `highWaterMark` of 64 kb.
|
|
112
|
+
*
|
|
113
|
+
* `options` can include `start` and `end` values to read a range of bytes from
|
|
114
|
+
* the file instead of the entire file. Both `start` and `end` are inclusive and
|
|
115
|
+
* start counting at 0, allowed values are in the
|
|
116
|
+
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `start` is
|
|
117
|
+
* omitted or `undefined`, `filehandle.createReadStream()` reads sequentially from
|
|
118
|
+
* the current file position. The `encoding` can be any one of those accepted by `Buffer`.
|
|
119
|
+
*
|
|
120
|
+
* If the `FileHandle` points to a character device that only supports blocking
|
|
121
|
+
* reads (such as keyboard or sound card), read operations do not finish until data
|
|
122
|
+
* is available. This can prevent the process from exiting and the stream from
|
|
123
|
+
* closing naturally.
|
|
124
|
+
*
|
|
125
|
+
* By default, the stream will emit a `'close'` event after it has been
|
|
126
|
+
* destroyed. Set the `emitClose` option to `false` to change this behavior.
|
|
127
|
+
*
|
|
128
|
+
* ```js
|
|
129
|
+
* import { open } from 'fs/promises';
|
|
130
|
+
*
|
|
131
|
+
* const fd = await open('/dev/input/event0');
|
|
132
|
+
* // Create a stream from some character device.
|
|
133
|
+
* const stream = fd.createReadStream();
|
|
134
|
+
* setTimeout(() => {
|
|
135
|
+
* stream.close(); // This may not close the stream.
|
|
136
|
+
* // Artificially marking end-of-stream, as if the underlying resource had
|
|
137
|
+
* // indicated end-of-file by itself, allows the stream to close.
|
|
138
|
+
* // This does not cancel pending read operations, and if there is such an
|
|
139
|
+
* // operation, the process may still not be able to exit successfully
|
|
140
|
+
* // until it finishes.
|
|
141
|
+
* stream.push(null);
|
|
142
|
+
* stream.read(0);
|
|
143
|
+
* }, 100);
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* If `autoClose` is false, then the file descriptor won't be closed, even if
|
|
147
|
+
* there's an error. It is the application's responsibility to close it and make
|
|
148
|
+
* sure there's no file descriptor leak. If `autoClose` is set to true (default
|
|
149
|
+
* behavior), on `'error'` or `'end'` the file descriptor will be closed
|
|
150
|
+
* automatically.
|
|
151
|
+
*
|
|
152
|
+
* An example to read the last 10 bytes of a file which is 100 bytes long:
|
|
153
|
+
*
|
|
154
|
+
* ```js
|
|
155
|
+
* import { open } from 'fs/promises';
|
|
156
|
+
*
|
|
157
|
+
* const fd = await open('sample.txt');
|
|
158
|
+
* fd.createReadStream({ start: 90, end: 99 });
|
|
159
|
+
* ```
|
|
160
|
+
* @since v16.11.0
|
|
161
|
+
*/
|
|
162
|
+
createReadStream(options?: CreateReadStreamOptions): ReadStream;
|
|
163
|
+
/**
|
|
164
|
+
* `options` may also include a `start` option to allow writing data at some
|
|
165
|
+
* position past the beginning of the file, allowed values are in the
|
|
166
|
+
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than replacing
|
|
167
|
+
* it may require the `flags` `open` option to be set to `r+` rather than the
|
|
168
|
+
* default `r`. The `encoding` can be any one of those accepted by `Buffer`.
|
|
169
|
+
*
|
|
170
|
+
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
|
171
|
+
* then the file descriptor won't be closed, even if there's an error.
|
|
172
|
+
* It is the application's responsibility to close it and make sure there's no
|
|
173
|
+
* file descriptor leak.
|
|
174
|
+
*
|
|
175
|
+
* By default, the stream will emit a `'close'` event after it has been
|
|
176
|
+
* destroyed. Set the `emitClose` option to `false` to change this behavior.
|
|
177
|
+
* @since v16.11.0
|
|
178
|
+
*/
|
|
179
|
+
createWriteStream(options?: CreateWriteStreamOptions): WriteStream;
|
|
180
|
+
/**
|
|
181
|
+
* Forces all currently queued I/O operations associated with the file to the
|
|
182
|
+
* operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details.
|
|
183
|
+
*
|
|
184
|
+
* Unlike `filehandle.sync` this method does not flush modified metadata.
|
|
185
|
+
* @since v10.0.0
|
|
186
|
+
* @return Fulfills with `undefined` upon success.
|
|
82
187
|
*/
|
|
83
188
|
datasync(): Promise<void>;
|
|
84
|
-
|
|
85
189
|
/**
|
|
86
|
-
*
|
|
190
|
+
* Request that all data for the open file descriptor is flushed to the storage
|
|
191
|
+
* device. The specific implementation is operating system and device specific.
|
|
192
|
+
* Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail.
|
|
193
|
+
* @since v10.0.0
|
|
194
|
+
* @return Fufills with `undefined` upon success.
|
|
87
195
|
*/
|
|
88
196
|
sync(): Promise<void>;
|
|
89
|
-
|
|
90
197
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
198
|
+
* Reads data from the file and stores that in the given buffer.
|
|
199
|
+
*
|
|
200
|
+
* If the file is not modified concurrently, the end-of-file is reached when the
|
|
201
|
+
* number of bytes read is zero.
|
|
202
|
+
* @since v10.0.0
|
|
203
|
+
* @param buffer A buffer that will be filled with the file data read.
|
|
204
|
+
* @param offset The location in the buffer at which to start filling.
|
|
95
205
|
* @param length The number of bytes to read.
|
|
96
|
-
* @param position The
|
|
206
|
+
* @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an
|
|
207
|
+
* integer, the current file position will remain unchanged.
|
|
208
|
+
* @return Fulfills upon success with an object with two properties:
|
|
97
209
|
*/
|
|
98
210
|
read<T extends ArrayBufferView>(buffer: T, offset?: number | null, length?: number | null, position?: number | null): Promise<FileReadResult<T>>;
|
|
99
211
|
read<T extends ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>;
|
|
100
212
|
/**
|
|
101
|
-
* Asynchronously reads the entire contents of a file.
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
213
|
+
* Asynchronously reads the entire contents of a file.
|
|
214
|
+
*
|
|
215
|
+
* If `options` is a string, then it specifies the `encoding`.
|
|
216
|
+
*
|
|
217
|
+
* The `FileHandle` has to support reading.
|
|
218
|
+
*
|
|
219
|
+
* If one or more `filehandle.read()` calls are made on a file handle and then a`filehandle.readFile()` call is made, the data will be read from the current
|
|
220
|
+
* position till the end of the file. It doesn't always read from the beginning
|
|
221
|
+
* of the file.
|
|
222
|
+
* @since v10.0.0
|
|
223
|
+
* @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the
|
|
224
|
+
* data will be a string.
|
|
105
225
|
*/
|
|
106
|
-
readFile(
|
|
107
|
-
|
|
226
|
+
readFile(
|
|
227
|
+
options?: {
|
|
228
|
+
encoding?: null | undefined;
|
|
229
|
+
flag?: OpenMode | undefined;
|
|
230
|
+
} | null
|
|
231
|
+
): Promise<Buffer>;
|
|
108
232
|
/**
|
|
109
233
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
110
234
|
* The `FileHandle` must have been opened for reading.
|
|
111
235
|
* @param options An object that may contain an optional flag.
|
|
112
236
|
* If a flag is not provided, it defaults to `'r'`.
|
|
113
237
|
*/
|
|
114
|
-
readFile(
|
|
115
|
-
|
|
238
|
+
readFile(
|
|
239
|
+
options:
|
|
240
|
+
| {
|
|
241
|
+
encoding: BufferEncoding;
|
|
242
|
+
flag?: OpenMode | undefined;
|
|
243
|
+
}
|
|
244
|
+
| BufferEncoding
|
|
245
|
+
): Promise<string>;
|
|
116
246
|
/**
|
|
117
247
|
* Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically.
|
|
118
248
|
* The `FileHandle` must have been opened for reading.
|
|
119
249
|
* @param options An object that may contain an optional flag.
|
|
120
250
|
* If a flag is not provided, it defaults to `'r'`.
|
|
121
251
|
*/
|
|
122
|
-
readFile(
|
|
123
|
-
|
|
252
|
+
readFile(
|
|
253
|
+
options?:
|
|
254
|
+
| (ObjectEncodingOptions & {
|
|
255
|
+
flag?: OpenMode | undefined;
|
|
256
|
+
})
|
|
257
|
+
| BufferEncoding
|
|
258
|
+
| null
|
|
259
|
+
): Promise<string | Buffer>;
|
|
124
260
|
/**
|
|
125
|
-
*
|
|
261
|
+
* @since v10.0.0
|
|
262
|
+
* @return Fulfills with an {fs.Stats} for the file.
|
|
126
263
|
*/
|
|
127
|
-
stat(
|
|
128
|
-
|
|
264
|
+
stat(
|
|
265
|
+
opts?: StatOptions & {
|
|
266
|
+
bigint?: false | undefined;
|
|
267
|
+
}
|
|
268
|
+
): Promise<Stats>;
|
|
269
|
+
stat(
|
|
270
|
+
opts: StatOptions & {
|
|
271
|
+
bigint: true;
|
|
272
|
+
}
|
|
273
|
+
): Promise<BigIntStats>;
|
|
129
274
|
stat(opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
130
|
-
|
|
131
275
|
/**
|
|
132
|
-
*
|
|
133
|
-
*
|
|
276
|
+
* Truncates the file.
|
|
277
|
+
*
|
|
278
|
+
* If the file was larger than `len` bytes, only the first `len` bytes will be
|
|
279
|
+
* retained in the file.
|
|
280
|
+
*
|
|
281
|
+
* The following example retains only the first four bytes of the file:
|
|
282
|
+
*
|
|
283
|
+
* ```js
|
|
284
|
+
* import { open } from 'fs/promises';
|
|
285
|
+
*
|
|
286
|
+
* let filehandle = null;
|
|
287
|
+
* try {
|
|
288
|
+
* filehandle = await open('temp.txt', 'r+');
|
|
289
|
+
* await filehandle.truncate(4);
|
|
290
|
+
* } finally {
|
|
291
|
+
* await filehandle?.close();
|
|
292
|
+
* }
|
|
293
|
+
* ```
|
|
294
|
+
*
|
|
295
|
+
* If the file previously was shorter than `len` bytes, it is extended, and the
|
|
296
|
+
* extended part is filled with null bytes (`'\0'`):
|
|
297
|
+
*
|
|
298
|
+
* If `len` is negative then `0` will be used.
|
|
299
|
+
* @since v10.0.0
|
|
300
|
+
* @param [len=0]
|
|
301
|
+
* @return Fulfills with `undefined` upon success.
|
|
134
302
|
*/
|
|
135
303
|
truncate(len?: number): Promise<void>;
|
|
136
|
-
|
|
137
304
|
/**
|
|
138
|
-
*
|
|
139
|
-
* @
|
|
140
|
-
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
305
|
+
* Change the file system timestamps of the object referenced by the `FileHandle` then resolves the promise with no arguments upon success.
|
|
306
|
+
* @since v10.0.0
|
|
141
307
|
*/
|
|
142
308
|
utimes(atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
143
|
-
|
|
144
309
|
/**
|
|
145
|
-
* Asynchronously writes
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
310
|
+
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an
|
|
311
|
+
* [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface) or
|
|
312
|
+
* [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object, or an
|
|
313
|
+
* object with an own `toString` function
|
|
314
|
+
* property. The promise is resolved with no arguments upon success.
|
|
315
|
+
*
|
|
316
|
+
* If `options` is a string, then it specifies the `encoding`.
|
|
317
|
+
*
|
|
318
|
+
* The `FileHandle` has to support writing.
|
|
319
|
+
*
|
|
320
|
+
* It is unsafe to use `filehandle.writeFile()` multiple times on the same file
|
|
321
|
+
* without waiting for the promise to be resolved (or rejected).
|
|
322
|
+
*
|
|
323
|
+
* If one or more `filehandle.write()` calls are made on a file handle and then a`filehandle.writeFile()` call is made, the data will be written from the
|
|
324
|
+
* current position till the end of the file. It doesn't always write from the
|
|
325
|
+
* beginning of the file.
|
|
326
|
+
* @since v10.0.0
|
|
151
327
|
*/
|
|
152
|
-
|
|
153
|
-
|
|
328
|
+
writeFile(data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode & Abortable) | BufferEncoding | null): Promise<void>;
|
|
154
329
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
330
|
+
* Write `buffer` to the file.
|
|
331
|
+
*
|
|
332
|
+
* If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
|
|
333
|
+
*
|
|
334
|
+
* The promise is resolved with an object containing two properties:
|
|
335
|
+
*
|
|
336
|
+
* It is unsafe to use `filehandle.write()` multiple times on the same file
|
|
337
|
+
* without waiting for the promise to be resolved (or rejected). For this
|
|
338
|
+
* scenario, use `fs.createWriteStream()`.
|
|
339
|
+
*
|
|
340
|
+
* On Linux, positional writes do not work when the file is opened in append mode.
|
|
341
|
+
* The kernel ignores the position argument and always appends the data to
|
|
342
|
+
* the end of the file.
|
|
343
|
+
* @since v10.0.0
|
|
344
|
+
* @param [offset=0] The start position from within `buffer` where the data to write begins.
|
|
345
|
+
* @param [length=buffer.byteLength] The number of bytes from `buffer` to write.
|
|
346
|
+
* @param position The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current position.
|
|
347
|
+
* See the POSIX pwrite(2) documentation for more detail.
|
|
162
348
|
*/
|
|
163
|
-
write
|
|
164
|
-
|
|
349
|
+
write<TBuffer extends Uint8Array>(
|
|
350
|
+
buffer: TBuffer,
|
|
351
|
+
offset?: number | null,
|
|
352
|
+
length?: number | null,
|
|
353
|
+
position?: number | null
|
|
354
|
+
): Promise<{
|
|
355
|
+
bytesWritten: number;
|
|
356
|
+
buffer: TBuffer;
|
|
357
|
+
}>;
|
|
358
|
+
write(
|
|
359
|
+
data: string,
|
|
360
|
+
position?: number | null,
|
|
361
|
+
encoding?: BufferEncoding | null
|
|
362
|
+
): Promise<{
|
|
363
|
+
bytesWritten: number;
|
|
364
|
+
buffer: string;
|
|
365
|
+
}>;
|
|
165
366
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
* See `fs.writev` promisified version.
|
|
367
|
+
* Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file.
|
|
368
|
+
*
|
|
369
|
+
* The promise is resolved with an object containing a two properties:
|
|
370
|
+
*
|
|
371
|
+
* It is unsafe to call `writev()` multiple times on the same file without waiting
|
|
372
|
+
* for the promise to be resolved (or rejected).
|
|
373
|
+
*
|
|
374
|
+
* On Linux, positional writes don't work when the file is opened in append mode.
|
|
375
|
+
* The kernel ignores the position argument and always appends the data to
|
|
376
|
+
* the end of the file.
|
|
377
|
+
* @since v12.9.0
|
|
378
|
+
* @param position The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current
|
|
379
|
+
* position.
|
|
180
380
|
*/
|
|
181
381
|
writev(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
|
|
182
|
-
|
|
183
382
|
/**
|
|
184
|
-
*
|
|
383
|
+
* Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s
|
|
384
|
+
* @since v13.13.0, v12.17.0
|
|
385
|
+
* @param position The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position.
|
|
386
|
+
* @return Fulfills upon success an object containing two properties:
|
|
185
387
|
*/
|
|
186
388
|
readv(buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
|
|
187
|
-
|
|
188
389
|
/**
|
|
189
|
-
*
|
|
390
|
+
* Closes the file handle after waiting for any pending operation on the handle to
|
|
391
|
+
* complete.
|
|
392
|
+
*
|
|
393
|
+
* ```js
|
|
394
|
+
* import { open } from 'fs/promises';
|
|
395
|
+
*
|
|
396
|
+
* let filehandle;
|
|
397
|
+
* try {
|
|
398
|
+
* filehandle = await open('thefile.txt', 'r');
|
|
399
|
+
* } finally {
|
|
400
|
+
* await filehandle?.close();
|
|
401
|
+
* }
|
|
402
|
+
* ```
|
|
403
|
+
* @since v10.0.0
|
|
404
|
+
* @return Fulfills with `undefined` upon success.
|
|
190
405
|
*/
|
|
191
406
|
close(): Promise<void>;
|
|
192
407
|
}
|
|
193
|
-
|
|
194
408
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
409
|
+
* Tests a user's permissions for the file or directory specified by `path`.
|
|
410
|
+
* The `mode` argument is an optional integer that specifies the accessibility
|
|
411
|
+
* checks to be performed. Check `File access constants` for possible values
|
|
412
|
+
* of `mode`. It is possible to create a mask consisting of the bitwise OR of
|
|
413
|
+
* two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
|
|
414
|
+
*
|
|
415
|
+
* If the accessibility check is successful, the promise is resolved with no
|
|
416
|
+
* value. If any of the accessibility checks fail, the promise is rejected
|
|
417
|
+
* with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and
|
|
418
|
+
* written by the current process.
|
|
419
|
+
*
|
|
420
|
+
* ```js
|
|
421
|
+
* import { access } from 'fs/promises';
|
|
422
|
+
* import { constants } from 'fs';
|
|
423
|
+
*
|
|
424
|
+
* try {
|
|
425
|
+
* await access('/etc/passwd', constants.R_OK | constants.W_OK);
|
|
426
|
+
* console.log('can access');
|
|
427
|
+
* } catch {
|
|
428
|
+
* console.error('cannot access');
|
|
429
|
+
* }
|
|
430
|
+
* ```
|
|
431
|
+
*
|
|
432
|
+
* Using `fsPromises.access()` to check for the accessibility of a file before
|
|
433
|
+
* calling `fsPromises.open()` is not recommended. Doing so introduces a race
|
|
434
|
+
* condition, since other processes may change the file's state between the two
|
|
435
|
+
* calls. Instead, user code should open/read/write the file directly and handle
|
|
436
|
+
* the error raised if the file is not accessible.
|
|
437
|
+
* @since v10.0.0
|
|
438
|
+
* @param [mode=fs.constants.F_OK]
|
|
439
|
+
* @return Fulfills with `undefined` upon success.
|
|
198
440
|
*/
|
|
199
441
|
function access(path: PathLike, mode?: number): Promise<void>;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
442
|
+
/**
|
|
443
|
+
* Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it
|
|
444
|
+
* already exists.
|
|
445
|
+
*
|
|
446
|
+
* No guarantees are made about the atomicity of the copy operation. If an
|
|
447
|
+
* error occurs after the destination file has been opened for writing, an attempt
|
|
448
|
+
* will be made to remove the destination.
|
|
449
|
+
*
|
|
450
|
+
* ```js
|
|
451
|
+
* import { constants } from 'fs';
|
|
452
|
+
* import { copyFile } from 'fs/promises';
|
|
453
|
+
*
|
|
454
|
+
* try {
|
|
455
|
+
* await copyFile('source.txt', 'destination.txt');
|
|
456
|
+
* console.log('source.txt was copied to destination.txt');
|
|
457
|
+
* } catch {
|
|
458
|
+
* console.log('The file could not be copied');
|
|
459
|
+
* }
|
|
460
|
+
*
|
|
461
|
+
* // By using COPYFILE_EXCL, the operation will fail if destination.txt exists.
|
|
462
|
+
* try {
|
|
463
|
+
* await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL);
|
|
464
|
+
* console.log('source.txt was copied to destination.txt');
|
|
465
|
+
* } catch {
|
|
466
|
+
* console.log('The file could not be copied');
|
|
467
|
+
* }
|
|
468
|
+
* ```
|
|
469
|
+
* @since v10.0.0
|
|
470
|
+
* @param src source filename to copy
|
|
471
|
+
* @param dest destination filename of the copy operation
|
|
472
|
+
* @param [mode=0] Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g.
|
|
473
|
+
* `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`)
|
|
474
|
+
* @return Fulfills with `undefined` upon success.
|
|
475
|
+
*/
|
|
476
|
+
function copyFile(src: PathLike, dest: PathLike, mode?: number): Promise<void>;
|
|
477
|
+
/**
|
|
478
|
+
* Opens a `FileHandle`.
|
|
479
|
+
*
|
|
480
|
+
* Refer to the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more detail.
|
|
481
|
+
*
|
|
482
|
+
* Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented
|
|
483
|
+
* by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains
|
|
484
|
+
* a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams).
|
|
485
|
+
* @since v10.0.0
|
|
486
|
+
* @param [flags='r'] See `support of file system `flags``.
|
|
487
|
+
* @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created.
|
|
488
|
+
* @return Fulfills with a {FileHandle} object.
|
|
219
489
|
*/
|
|
220
490
|
function open(path: PathLike, flags: string | number, mode?: Mode): Promise<FileHandle>;
|
|
221
|
-
|
|
222
491
|
/**
|
|
223
|
-
*
|
|
224
|
-
* @
|
|
225
|
-
*
|
|
226
|
-
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
227
|
-
* URL support is _experimental_.
|
|
492
|
+
* Renames `oldPath` to `newPath`.
|
|
493
|
+
* @since v10.0.0
|
|
494
|
+
* @return Fulfills with `undefined` upon success.
|
|
228
495
|
*/
|
|
229
496
|
function rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
|
230
|
-
|
|
231
497
|
/**
|
|
232
|
-
*
|
|
233
|
-
* @
|
|
234
|
-
* @param len
|
|
498
|
+
* Truncates (shortens or extends the length) of the content at `path` to `len`bytes.
|
|
499
|
+
* @since v10.0.0
|
|
500
|
+
* @param [len=0]
|
|
501
|
+
* @return Fulfills with `undefined` upon success.
|
|
235
502
|
*/
|
|
236
503
|
function truncate(path: PathLike, len?: number): Promise<void>;
|
|
237
|
-
|
|
238
504
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
505
|
+
* Removes the directory identified by `path`.
|
|
506
|
+
*
|
|
507
|
+
* Using `fsPromises.rmdir()` on a file (not a directory) results in the
|
|
508
|
+
* promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR`error on POSIX.
|
|
509
|
+
*
|
|
510
|
+
* To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`.
|
|
511
|
+
* @since v10.0.0
|
|
512
|
+
* @return Fulfills with `undefined` upon success.
|
|
241
513
|
*/
|
|
242
514
|
function rmdir(path: PathLike, options?: RmDirOptions): Promise<void>;
|
|
243
|
-
|
|
244
515
|
/**
|
|
245
|
-
*
|
|
516
|
+
* Removes files and directories (modeled on the standard POSIX `rm` utility).
|
|
517
|
+
* @since v14.14.0
|
|
518
|
+
* @return Fulfills with `undefined` upon success.
|
|
246
519
|
*/
|
|
247
520
|
function rm(path: PathLike, options?: RmOptions): Promise<void>;
|
|
248
|
-
|
|
249
521
|
/**
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
522
|
+
* Asynchronously creates a directory.
|
|
523
|
+
*
|
|
524
|
+
* The optional `options` argument can be an integer specifying `mode` (permission
|
|
525
|
+
* and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fsPromises.mkdir()` when `path` is a directory
|
|
526
|
+
* that exists results in a
|
|
527
|
+
* rejection only when `recursive` is false.
|
|
528
|
+
* @since v10.0.0
|
|
529
|
+
* @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`.
|
|
254
530
|
*/
|
|
255
|
-
function mkdir(
|
|
256
|
-
|
|
531
|
+
function mkdir(
|
|
532
|
+
path: PathLike,
|
|
533
|
+
options: MakeDirectoryOptions & {
|
|
534
|
+
recursive: true;
|
|
535
|
+
}
|
|
536
|
+
): Promise<string | undefined>;
|
|
257
537
|
/**
|
|
258
538
|
* Asynchronous mkdir(2) - create a directory.
|
|
259
539
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
260
540
|
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
|
261
541
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
262
542
|
*/
|
|
263
|
-
function mkdir(
|
|
264
|
-
|
|
543
|
+
function mkdir(
|
|
544
|
+
path: PathLike,
|
|
545
|
+
options?:
|
|
546
|
+
| Mode
|
|
547
|
+
| (MakeDirectoryOptions & {
|
|
548
|
+
recursive?: false | undefined;
|
|
549
|
+
})
|
|
550
|
+
| null
|
|
551
|
+
): Promise<void>;
|
|
265
552
|
/**
|
|
266
553
|
* Asynchronous mkdir(2) - create a directory.
|
|
267
554
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -269,226 +556,404 @@ declare module 'fs/promises' {
|
|
|
269
556
|
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
|
270
557
|
*/
|
|
271
558
|
function mkdir(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise<string | undefined>;
|
|
272
|
-
|
|
273
559
|
/**
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
560
|
+
* Reads the contents of a directory.
|
|
561
|
+
*
|
|
562
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
|
563
|
+
* object with an `encoding` property specifying the character encoding to use for
|
|
564
|
+
* the filenames. If the `encoding` is set to `'buffer'`, the filenames returned
|
|
565
|
+
* will be passed as `Buffer` objects.
|
|
566
|
+
*
|
|
567
|
+
* If `options.withFileTypes` is set to `true`, the resolved array will contain `fs.Dirent` objects.
|
|
568
|
+
*
|
|
569
|
+
* ```js
|
|
570
|
+
* import { readdir } from 'fs/promises';
|
|
571
|
+
*
|
|
572
|
+
* try {
|
|
573
|
+
* const files = await readdir(path);
|
|
574
|
+
* for (const file of files)
|
|
575
|
+
* console.log(file);
|
|
576
|
+
* } catch (err) {
|
|
577
|
+
* console.error(err);
|
|
578
|
+
* }
|
|
579
|
+
* ```
|
|
580
|
+
* @since v10.0.0
|
|
581
|
+
* @return Fulfills with an array of the names of the files in the directory excluding `'.'` and `'..'`.
|
|
277
582
|
*/
|
|
278
|
-
function readdir(
|
|
279
|
-
|
|
583
|
+
function readdir(
|
|
584
|
+
path: PathLike,
|
|
585
|
+
options?:
|
|
586
|
+
| (ObjectEncodingOptions & {
|
|
587
|
+
withFileTypes?: false | undefined;
|
|
588
|
+
})
|
|
589
|
+
| BufferEncoding
|
|
590
|
+
| null
|
|
591
|
+
): Promise<string[]>;
|
|
280
592
|
/**
|
|
281
593
|
* Asynchronous readdir(3) - read a directory.
|
|
282
594
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
283
595
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
284
596
|
*/
|
|
285
|
-
function readdir(
|
|
286
|
-
|
|
597
|
+
function readdir(
|
|
598
|
+
path: PathLike,
|
|
599
|
+
options:
|
|
600
|
+
| {
|
|
601
|
+
encoding: 'buffer';
|
|
602
|
+
withFileTypes?: false | undefined;
|
|
603
|
+
}
|
|
604
|
+
| 'buffer'
|
|
605
|
+
): Promise<Buffer[]>;
|
|
287
606
|
/**
|
|
288
607
|
* Asynchronous readdir(3) - read a directory.
|
|
289
608
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
290
609
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
291
610
|
*/
|
|
292
|
-
function readdir(
|
|
293
|
-
|
|
611
|
+
function readdir(
|
|
612
|
+
path: PathLike,
|
|
613
|
+
options?:
|
|
614
|
+
| (ObjectEncodingOptions & {
|
|
615
|
+
withFileTypes?: false | undefined;
|
|
616
|
+
})
|
|
617
|
+
| BufferEncoding
|
|
618
|
+
| null
|
|
619
|
+
): Promise<string[] | Buffer[]>;
|
|
294
620
|
/**
|
|
295
621
|
* Asynchronous readdir(3) - read a directory.
|
|
296
622
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
297
623
|
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
|
298
624
|
*/
|
|
299
|
-
function readdir(
|
|
300
|
-
|
|
625
|
+
function readdir(
|
|
626
|
+
path: PathLike,
|
|
627
|
+
options: ObjectEncodingOptions & {
|
|
628
|
+
withFileTypes: true;
|
|
629
|
+
}
|
|
630
|
+
): Promise<Dirent[]>;
|
|
301
631
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
632
|
+
* 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
|
|
633
|
+
* resolved with the`linkString` upon success.
|
|
634
|
+
*
|
|
635
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
|
636
|
+
* object with an `encoding` property specifying the character encoding to use for
|
|
637
|
+
* the link path returned. If the `encoding` is set to `'buffer'`, the link path
|
|
638
|
+
* returned will be passed as a `Buffer` object.
|
|
639
|
+
* @since v10.0.0
|
|
640
|
+
* @return Fulfills with the `linkString` upon success.
|
|
305
641
|
*/
|
|
306
642
|
function readlink(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
|
|
307
|
-
|
|
308
643
|
/**
|
|
309
644
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
310
645
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
311
646
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
312
647
|
*/
|
|
313
648
|
function readlink(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
|
|
314
|
-
|
|
315
649
|
/**
|
|
316
650
|
* Asynchronous readlink(2) - read value of a symbolic link.
|
|
317
651
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
318
652
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
319
653
|
*/
|
|
320
654
|
function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise<string | Buffer>;
|
|
321
|
-
|
|
322
655
|
/**
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
327
|
-
*
|
|
656
|
+
* Creates a symbolic link.
|
|
657
|
+
*
|
|
658
|
+
* The `type` argument is only used on Windows platforms and can be one of `'dir'`,`'file'`, or `'junction'`. Windows junction points require the destination path
|
|
659
|
+
* to be absolute. When using `'junction'`, the `target` argument will
|
|
660
|
+
* automatically be normalized to absolute path.
|
|
661
|
+
* @since v10.0.0
|
|
662
|
+
* @param [type='file']
|
|
663
|
+
* @return Fulfills with `undefined` upon success.
|
|
328
664
|
*/
|
|
329
665
|
function symlink(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
|
|
330
|
-
|
|
331
666
|
/**
|
|
332
|
-
*
|
|
333
|
-
*
|
|
667
|
+
* Equivalent to `fsPromises.stat()` unless `path` refers to a symbolic link,
|
|
668
|
+
* in which case the link itself is stat-ed, not the file that it refers to.
|
|
669
|
+
* Refer to the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) document for more detail.
|
|
670
|
+
* @since v10.0.0
|
|
671
|
+
* @return Fulfills with the {fs.Stats} object for the given symbolic link `path`.
|
|
334
672
|
*/
|
|
335
|
-
function lstat(
|
|
336
|
-
|
|
673
|
+
function lstat(
|
|
674
|
+
path: PathLike,
|
|
675
|
+
opts?: StatOptions & {
|
|
676
|
+
bigint?: false | undefined;
|
|
677
|
+
}
|
|
678
|
+
): Promise<Stats>;
|
|
679
|
+
function lstat(
|
|
680
|
+
path: PathLike,
|
|
681
|
+
opts: StatOptions & {
|
|
682
|
+
bigint: true;
|
|
683
|
+
}
|
|
684
|
+
): Promise<BigIntStats>;
|
|
337
685
|
function lstat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
338
|
-
|
|
339
686
|
/**
|
|
340
|
-
*
|
|
341
|
-
* @
|
|
687
|
+
* @since v10.0.0
|
|
688
|
+
* @return Fulfills with the {fs.Stats} object for the given `path`.
|
|
342
689
|
*/
|
|
343
|
-
function stat(
|
|
344
|
-
|
|
690
|
+
function stat(
|
|
691
|
+
path: PathLike,
|
|
692
|
+
opts?: StatOptions & {
|
|
693
|
+
bigint?: false | undefined;
|
|
694
|
+
}
|
|
695
|
+
): Promise<Stats>;
|
|
696
|
+
function stat(
|
|
697
|
+
path: PathLike,
|
|
698
|
+
opts: StatOptions & {
|
|
699
|
+
bigint: true;
|
|
700
|
+
}
|
|
701
|
+
): Promise<BigIntStats>;
|
|
345
702
|
function stat(path: PathLike, opts?: StatOptions): Promise<Stats | BigIntStats>;
|
|
346
|
-
|
|
347
703
|
/**
|
|
348
|
-
*
|
|
349
|
-
* @
|
|
350
|
-
* @
|
|
704
|
+
* Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail.
|
|
705
|
+
* @since v10.0.0
|
|
706
|
+
* @return Fulfills with `undefined` upon success.
|
|
351
707
|
*/
|
|
352
708
|
function link(existingPath: PathLike, newPath: PathLike): Promise<void>;
|
|
353
|
-
|
|
354
709
|
/**
|
|
355
|
-
*
|
|
356
|
-
*
|
|
710
|
+
* If `path` refers to a symbolic link, then the link is removed without affecting
|
|
711
|
+
* the file or directory to which that link refers. If the `path` refers to a file
|
|
712
|
+
* path that is not a symbolic link, the file is deleted. See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more detail.
|
|
713
|
+
* @since v10.0.0
|
|
714
|
+
* @return Fulfills with `undefined` upon success.
|
|
357
715
|
*/
|
|
358
716
|
function unlink(path: PathLike): Promise<void>;
|
|
359
|
-
|
|
360
717
|
/**
|
|
361
|
-
*
|
|
362
|
-
* @
|
|
363
|
-
* @
|
|
718
|
+
* Changes the permissions of a file.
|
|
719
|
+
* @since v10.0.0
|
|
720
|
+
* @return Fulfills with `undefined` upon success.
|
|
364
721
|
*/
|
|
365
722
|
function chmod(path: PathLike, mode: Mode): Promise<void>;
|
|
366
|
-
|
|
367
723
|
/**
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
724
|
+
* Changes the permissions on a symbolic link.
|
|
725
|
+
*
|
|
726
|
+
* This method is only implemented on macOS.
|
|
727
|
+
* @deprecated Since v10.0.0
|
|
728
|
+
* @return Fulfills with `undefined` upon success.
|
|
371
729
|
*/
|
|
372
730
|
function lchmod(path: PathLike, mode: Mode): Promise<void>;
|
|
373
|
-
|
|
374
731
|
/**
|
|
375
|
-
*
|
|
376
|
-
* @
|
|
732
|
+
* Changes the ownership on a symbolic link.
|
|
733
|
+
* @since v10.0.0
|
|
734
|
+
* @return Fulfills with `undefined` upon success.
|
|
377
735
|
*/
|
|
378
736
|
function lchown(path: PathLike, uid: number, gid: number): Promise<void>;
|
|
379
|
-
|
|
380
737
|
/**
|
|
381
|
-
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* @
|
|
385
|
-
* @
|
|
386
|
-
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
|
738
|
+
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, with the difference that if the path refers to a
|
|
739
|
+
* symbolic link, then the link is not dereferenced: instead, the timestamps of
|
|
740
|
+
* the symbolic link itself are changed.
|
|
741
|
+
* @since v14.5.0, v12.19.0
|
|
742
|
+
* @return Fulfills with `undefined` upon success.
|
|
387
743
|
*/
|
|
388
744
|
function lutimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
389
|
-
|
|
390
745
|
/**
|
|
391
|
-
*
|
|
392
|
-
* @
|
|
746
|
+
* Changes the ownership of a file.
|
|
747
|
+
* @since v10.0.0
|
|
748
|
+
* @return Fulfills with `undefined` upon success.
|
|
393
749
|
*/
|
|
394
750
|
function chown(path: PathLike, uid: number, gid: number): Promise<void>;
|
|
395
|
-
|
|
396
751
|
/**
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
752
|
+
* Change the file system timestamps of the object referenced by `path`.
|
|
753
|
+
*
|
|
754
|
+
* The `atime` and `mtime` arguments follow these rules:
|
|
755
|
+
*
|
|
756
|
+
* * Values can be either numbers representing Unix epoch time, `Date`s, or a
|
|
757
|
+
* numeric string like `'123456789.0'`.
|
|
758
|
+
* * If the value can not be converted to a number, or is `NaN`, `Infinity` or`-Infinity`, an `Error` will be thrown.
|
|
759
|
+
* @since v10.0.0
|
|
760
|
+
* @return Fulfills with `undefined` upon success.
|
|
401
761
|
*/
|
|
402
762
|
function utimes(path: PathLike, atime: string | number | Date, mtime: string | number | Date): Promise<void>;
|
|
403
|
-
|
|
404
763
|
/**
|
|
405
|
-
*
|
|
406
|
-
*
|
|
407
|
-
*
|
|
764
|
+
* Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function.
|
|
765
|
+
*
|
|
766
|
+
* Only paths that can be converted to UTF8 strings are supported.
|
|
767
|
+
*
|
|
768
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
|
769
|
+
* object with an `encoding` property specifying the character encoding to use for
|
|
770
|
+
* the path. If the `encoding` is set to `'buffer'`, the path returned will be
|
|
771
|
+
* passed as a `Buffer` object.
|
|
772
|
+
*
|
|
773
|
+
* On Linux, when Node.js is linked against musl libc, the procfs file system must
|
|
774
|
+
* be mounted on `/proc` in order for this function to work. Glibc does not have
|
|
775
|
+
* this restriction.
|
|
776
|
+
* @since v10.0.0
|
|
777
|
+
* @return Fulfills with the resolved path upon success.
|
|
408
778
|
*/
|
|
409
779
|
function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
|
|
410
|
-
|
|
411
780
|
/**
|
|
412
781
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
413
782
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
414
783
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
415
784
|
*/
|
|
416
785
|
function realpath(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
|
|
417
|
-
|
|
418
786
|
/**
|
|
419
787
|
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
|
420
788
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
421
789
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
422
790
|
*/
|
|
423
791
|
function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
|
|
424
|
-
|
|
425
792
|
/**
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
793
|
+
* Creates a unique temporary directory. A unique directory name is generated by
|
|
794
|
+
* appending six random characters to the end of the provided `prefix`. Due to
|
|
795
|
+
* platform inconsistencies, avoid trailing `X` characters in `prefix`. Some
|
|
796
|
+
* platforms, notably the BSDs, can return more than six random characters, and
|
|
797
|
+
* replace trailing `X` characters in `prefix` with random characters.
|
|
798
|
+
*
|
|
799
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
|
800
|
+
* object with an `encoding` property specifying the character encoding to use.
|
|
801
|
+
*
|
|
802
|
+
* ```js
|
|
803
|
+
* import { mkdtemp } from 'fs/promises';
|
|
804
|
+
*
|
|
805
|
+
* try {
|
|
806
|
+
* await mkdtemp(path.join(os.tmpdir(), 'foo-'));
|
|
807
|
+
* } catch (err) {
|
|
808
|
+
* console.error(err);
|
|
809
|
+
* }
|
|
810
|
+
* ```
|
|
811
|
+
*
|
|
812
|
+
* The `fsPromises.mkdtemp()` method will append the six randomly selected
|
|
813
|
+
* characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing
|
|
814
|
+
* platform-specific path separator
|
|
815
|
+
* (`require('path').sep`).
|
|
816
|
+
* @since v10.0.0
|
|
817
|
+
* @return Fulfills with a string containing the filesystem path of the newly created temporary directory.
|
|
429
818
|
*/
|
|
430
819
|
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string>;
|
|
431
|
-
|
|
432
820
|
/**
|
|
433
821
|
* Asynchronously creates a unique temporary directory.
|
|
434
822
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
435
823
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
436
824
|
*/
|
|
437
825
|
function mkdtemp(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
|
|
438
|
-
|
|
439
826
|
/**
|
|
440
827
|
* Asynchronously creates a unique temporary directory.
|
|
441
828
|
* Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory.
|
|
442
829
|
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
|
443
830
|
*/
|
|
444
831
|
function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise<string | Buffer>;
|
|
445
|
-
|
|
446
832
|
/**
|
|
447
|
-
* Asynchronously writes data to a file, replacing the file if it already exists.
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
* If
|
|
452
|
-
*
|
|
453
|
-
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
*
|
|
833
|
+
* Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a `Buffer`, or, an object with an own (not inherited)`toString` function property.
|
|
834
|
+
*
|
|
835
|
+
* The `encoding` option is ignored if `data` is a buffer.
|
|
836
|
+
*
|
|
837
|
+
* If `options` is a string, then it specifies the encoding.
|
|
838
|
+
*
|
|
839
|
+
* The `mode` option only affects the newly created file. See `fs.open()` for more details.
|
|
840
|
+
*
|
|
841
|
+
* Any specified `FileHandle` has to support writing.
|
|
842
|
+
*
|
|
843
|
+
* It is unsafe to use `fsPromises.writeFile()` multiple times on the same file
|
|
844
|
+
* without waiting for the promise to be settled.
|
|
845
|
+
*
|
|
846
|
+
* Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience
|
|
847
|
+
* method that performs multiple `write` calls internally to write the buffer
|
|
848
|
+
* passed to it. For performance sensitive code consider using `fs.createWriteStream()`.
|
|
849
|
+
*
|
|
850
|
+
* It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`.
|
|
851
|
+
* Cancelation is "best effort", and some amount of data is likely still
|
|
852
|
+
* to be written.
|
|
853
|
+
*
|
|
854
|
+
* ```js
|
|
855
|
+
* import { writeFile } from 'fs/promises';
|
|
856
|
+
* import { Buffer } from 'buffer';
|
|
857
|
+
*
|
|
858
|
+
* try {
|
|
859
|
+
* const controller = new AbortController();
|
|
860
|
+
* const { signal } = controller;
|
|
861
|
+
* const data = new Uint8Array(Buffer.from('Hello Node.js'));
|
|
862
|
+
* const promise = writeFile('message.txt', data, { signal });
|
|
863
|
+
*
|
|
864
|
+
* // Abort the request before the promise settles.
|
|
865
|
+
* controller.abort();
|
|
866
|
+
*
|
|
867
|
+
* await promise;
|
|
868
|
+
* } catch (err) {
|
|
869
|
+
* // When a request is aborted - err is an AbortError
|
|
870
|
+
* console.error(err);
|
|
871
|
+
* }
|
|
872
|
+
* ```
|
|
873
|
+
*
|
|
874
|
+
* Aborting an ongoing request does not abort individual operating
|
|
875
|
+
* system requests but rather the internal buffering `fs.writeFile` performs.
|
|
876
|
+
* @since v10.0.0
|
|
877
|
+
* @param file filename or `FileHandle`
|
|
878
|
+
* @return Fulfills with `undefined` upon success.
|
|
458
879
|
*/
|
|
459
880
|
function writeFile(
|
|
460
|
-
|
|
881
|
+
file: PathLike | FileHandle,
|
|
461
882
|
data: string | NodeJS.ArrayBufferView | Iterable<string | NodeJS.ArrayBufferView> | AsyncIterable<string | NodeJS.ArrayBufferView> | Stream,
|
|
462
|
-
options?:
|
|
883
|
+
options?:
|
|
884
|
+
| (ObjectEncodingOptions & {
|
|
885
|
+
mode?: Mode | undefined;
|
|
886
|
+
flag?: OpenMode | undefined;
|
|
887
|
+
} & Abortable)
|
|
888
|
+
| BufferEncoding
|
|
889
|
+
| null
|
|
463
890
|
): Promise<void>;
|
|
464
|
-
|
|
465
891
|
/**
|
|
466
|
-
* Asynchronously append data to a file, creating the file if it does not
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
* If
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
892
|
+
* Asynchronously append data to a file, creating the file if it does not yet
|
|
893
|
+
* exist. `data` can be a string or a `Buffer`.
|
|
894
|
+
*
|
|
895
|
+
* If `options` is a string, then it specifies the `encoding`.
|
|
896
|
+
*
|
|
897
|
+
* The `mode` option only affects the newly created file. See `fs.open()` for more details.
|
|
898
|
+
*
|
|
899
|
+
* The `path` may be specified as a `FileHandle` that has been opened
|
|
900
|
+
* for appending (using `fsPromises.open()`).
|
|
901
|
+
* @since v10.0.0
|
|
902
|
+
* @param path filename or {FileHandle}
|
|
903
|
+
* @return Fulfills with `undefined` upon success.
|
|
476
904
|
*/
|
|
477
|
-
function appendFile(
|
|
478
|
-
path: PathLike | FileHandle,
|
|
479
|
-
data: string | Uint8Array,
|
|
480
|
-
options?: ObjectEncodingOptions & FlagAndOpenMode | BufferEncoding | null,
|
|
481
|
-
): Promise<void>;
|
|
482
|
-
|
|
905
|
+
function appendFile(path: PathLike | FileHandle, data: string | Uint8Array, options?: (ObjectEncodingOptions & FlagAndOpenMode) | BufferEncoding | null): Promise<void>;
|
|
483
906
|
/**
|
|
484
907
|
* Asynchronously reads the entire contents of a file.
|
|
485
|
-
*
|
|
486
|
-
* If
|
|
487
|
-
*
|
|
488
|
-
*
|
|
908
|
+
*
|
|
909
|
+
* If no encoding is specified (using `options.encoding`), the data is returned
|
|
910
|
+
* as a `Buffer` object. Otherwise, the data will be a string.
|
|
911
|
+
*
|
|
912
|
+
* If `options` is a string, then it specifies the encoding.
|
|
913
|
+
*
|
|
914
|
+
* When the `path` is a directory, the behavior of `fsPromises.readFile()` is
|
|
915
|
+
* platform-specific. On macOS, Linux, and Windows, the promise will be rejected
|
|
916
|
+
* with an error. On FreeBSD, a representation of the directory's contents will be
|
|
917
|
+
* returned.
|
|
918
|
+
*
|
|
919
|
+
* It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a
|
|
920
|
+
* request is aborted the promise returned is rejected with an `AbortError`:
|
|
921
|
+
*
|
|
922
|
+
* ```js
|
|
923
|
+
* import { readFile } from 'fs/promises';
|
|
924
|
+
*
|
|
925
|
+
* try {
|
|
926
|
+
* const controller = new AbortController();
|
|
927
|
+
* const { signal } = controller;
|
|
928
|
+
* const promise = readFile(fileName, { signal });
|
|
929
|
+
*
|
|
930
|
+
* // Abort the request before the promise settles.
|
|
931
|
+
* controller.abort();
|
|
932
|
+
*
|
|
933
|
+
* await promise;
|
|
934
|
+
* } catch (err) {
|
|
935
|
+
* // When a request is aborted - err is an AbortError
|
|
936
|
+
* console.error(err);
|
|
937
|
+
* }
|
|
938
|
+
* ```
|
|
939
|
+
*
|
|
940
|
+
* Aborting an ongoing request does not abort individual operating
|
|
941
|
+
* system requests but rather the internal buffering `fs.readFile` performs.
|
|
942
|
+
*
|
|
943
|
+
* Any specified `FileHandle` has to support reading.
|
|
944
|
+
* @since v10.0.0
|
|
945
|
+
* @param path filename or `FileHandle`
|
|
946
|
+
* @return Fulfills with the contents of the file.
|
|
489
947
|
*/
|
|
490
|
-
function readFile(
|
|
491
|
-
|
|
948
|
+
function readFile(
|
|
949
|
+
path: PathLike | FileHandle,
|
|
950
|
+
options?:
|
|
951
|
+
| ({
|
|
952
|
+
encoding?: null | undefined;
|
|
953
|
+
flag?: OpenMode | undefined;
|
|
954
|
+
} & Abortable)
|
|
955
|
+
| null
|
|
956
|
+
): Promise<Buffer>;
|
|
492
957
|
/**
|
|
493
958
|
* Asynchronously reads the entire contents of a file.
|
|
494
959
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -496,8 +961,15 @@ declare module 'fs/promises' {
|
|
|
496
961
|
* @param options An object that may contain an optional flag.
|
|
497
962
|
* If a flag is not provided, it defaults to `'r'`.
|
|
498
963
|
*/
|
|
499
|
-
function readFile(
|
|
500
|
-
|
|
964
|
+
function readFile(
|
|
965
|
+
path: PathLike | FileHandle,
|
|
966
|
+
options:
|
|
967
|
+
| ({
|
|
968
|
+
encoding: BufferEncoding;
|
|
969
|
+
flag?: OpenMode | undefined;
|
|
970
|
+
} & Abortable)
|
|
971
|
+
| BufferEncoding
|
|
972
|
+
): Promise<string>;
|
|
501
973
|
/**
|
|
502
974
|
* Asynchronously reads the entire contents of a file.
|
|
503
975
|
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -505,20 +977,83 @@ declare module 'fs/promises' {
|
|
|
505
977
|
* @param options An object that may contain an optional flag.
|
|
506
978
|
* If a flag is not provided, it defaults to `'r'`.
|
|
507
979
|
*/
|
|
508
|
-
function readFile(
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
980
|
+
function readFile(
|
|
981
|
+
path: PathLike | FileHandle,
|
|
982
|
+
options?:
|
|
983
|
+
| (ObjectEncodingOptions &
|
|
984
|
+
Abortable & {
|
|
985
|
+
flag?: OpenMode | undefined;
|
|
986
|
+
})
|
|
987
|
+
| BufferEncoding
|
|
988
|
+
| null
|
|
989
|
+
): Promise<string | Buffer>;
|
|
512
990
|
/**
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
*
|
|
518
|
-
*
|
|
991
|
+
* Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail.
|
|
992
|
+
*
|
|
993
|
+
* Creates an `fs.Dir`, which contains all further functions for reading from
|
|
994
|
+
* and cleaning up the directory.
|
|
995
|
+
*
|
|
996
|
+
* The `encoding` option sets the encoding for the `path` while opening the
|
|
997
|
+
* directory and subsequent read operations.
|
|
998
|
+
*
|
|
999
|
+
* Example using async iteration:
|
|
1000
|
+
*
|
|
1001
|
+
* ```js
|
|
1002
|
+
* import { opendir } from 'fs/promises';
|
|
1003
|
+
*
|
|
1004
|
+
* try {
|
|
1005
|
+
* const dir = await opendir('./');
|
|
1006
|
+
* for await (const dirent of dir)
|
|
1007
|
+
* console.log(dirent.name);
|
|
1008
|
+
* } catch (err) {
|
|
1009
|
+
* console.error(err);
|
|
1010
|
+
* }
|
|
1011
|
+
* ```
|
|
1012
|
+
*
|
|
1013
|
+
* When using the async iterator, the `fs.Dir` object will be automatically
|
|
1014
|
+
* closed after the iterator exits.
|
|
1015
|
+
* @since v12.12.0
|
|
1016
|
+
* @return Fulfills with an {fs.Dir}.
|
|
1017
|
+
*/
|
|
1018
|
+
function opendir(path: PathLike, options?: OpenDirOptions): Promise<Dir>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory.
|
|
1021
|
+
*
|
|
1022
|
+
* ```js
|
|
1023
|
+
* const { watch } = require('fs/promises');
|
|
1024
|
+
*
|
|
1025
|
+
* const ac = new AbortController();
|
|
1026
|
+
* const { signal } = ac;
|
|
1027
|
+
* setTimeout(() => ac.abort(), 10000);
|
|
1028
|
+
*
|
|
1029
|
+
* (async () => {
|
|
1030
|
+
* try {
|
|
1031
|
+
* const watcher = watch(__filename, { signal });
|
|
1032
|
+
* for await (const event of watcher)
|
|
1033
|
+
* console.log(event);
|
|
1034
|
+
* } catch (err) {
|
|
1035
|
+
* if (err.name === 'AbortError')
|
|
1036
|
+
* return;
|
|
1037
|
+
* throw err;
|
|
1038
|
+
* }
|
|
1039
|
+
* })();
|
|
1040
|
+
* ```
|
|
1041
|
+
*
|
|
1042
|
+
* On most platforms, `'rename'` is emitted whenever a filename appears or
|
|
1043
|
+
* disappears in the directory.
|
|
1044
|
+
*
|
|
1045
|
+
* All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`.
|
|
1046
|
+
* @since v15.9.0
|
|
1047
|
+
* @return of objects with the properties:
|
|
519
1048
|
*/
|
|
520
|
-
function watch(
|
|
521
|
-
|
|
1049
|
+
function watch(
|
|
1050
|
+
filename: PathLike,
|
|
1051
|
+
options:
|
|
1052
|
+
| (WatchOptions & {
|
|
1053
|
+
encoding: 'buffer';
|
|
1054
|
+
})
|
|
1055
|
+
| 'buffer'
|
|
1056
|
+
): AsyncIterable<FileChangeInfo<Buffer>>;
|
|
522
1057
|
/**
|
|
523
1058
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
524
1059
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -527,11 +1062,7 @@ declare module 'fs/promises' {
|
|
|
527
1062
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
528
1063
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
529
1064
|
*/
|
|
530
|
-
function watch(
|
|
531
|
-
filename: PathLike,
|
|
532
|
-
options?: WatchOptions | BufferEncoding
|
|
533
|
-
): AsyncIterable<string>;
|
|
534
|
-
|
|
1065
|
+
function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable<FileChangeInfo<string>>;
|
|
535
1066
|
/**
|
|
536
1067
|
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
|
537
1068
|
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
|
@@ -540,9 +1071,21 @@ declare module 'fs/promises' {
|
|
|
540
1071
|
* If `persistent` is not supplied, the default of `true` is used.
|
|
541
1072
|
* If `recursive` is not supplied, the default of `false` is used.
|
|
542
1073
|
*/
|
|
543
|
-
function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable<string
|
|
1074
|
+
function watch(filename: PathLike, options: WatchOptions | string): AsyncIterable<FileChangeInfo<string>> | AsyncIterable<FileChangeInfo<Buffer>>;
|
|
1075
|
+
/**
|
|
1076
|
+
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
|
1077
|
+
* including subdirectories and files.
|
|
1078
|
+
*
|
|
1079
|
+
* When copying a directory to another directory, globs are not supported and
|
|
1080
|
+
* behavior is similar to `cp dir1/ dir2/`.
|
|
1081
|
+
* @since v16.7.0
|
|
1082
|
+
* @experimental
|
|
1083
|
+
* @param src source path to copy.
|
|
1084
|
+
* @param dest destination path to copy to.
|
|
1085
|
+
* @return Fulfills with `undefined` upon success.
|
|
1086
|
+
*/
|
|
1087
|
+
function cp(source: string, destination: string, opts?: CopyOptions): Promise<void>;
|
|
544
1088
|
}
|
|
545
|
-
|
|
546
1089
|
declare module 'node:fs/promises' {
|
|
547
1090
|
export * from 'fs/promises';
|
|
548
1091
|
}
|