isomorfeus-puppetmaster 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isomorfeus/puppetmaster/driver/puppeteer.rb +21 -18
- data/lib/isomorfeus/puppetmaster/driver_registration.rb +4 -4
- data/lib/isomorfeus/puppetmaster/server_registration.rb +0 -52
- data/lib/isomorfeus/puppetmaster/version.rb +1 -1
- data/lib/isomorfeus/puppetmaster.rb +6 -3
- data/lib/isomorfeus-puppetmaster.rb +2 -1
- data/node_modules/.bin/extract-zip +12 -0
- data/node_modules/.bin/extract-zip.cmd +17 -0
- data/node_modules/.bin/extract-zip.ps1 +28 -0
- data/node_modules/.bin/mkdirp +12 -0
- data/node_modules/.bin/mkdirp.cmd +17 -0
- data/node_modules/.bin/mkdirp.ps1 +28 -0
- data/node_modules/.bin/rimraf +12 -0
- data/node_modules/.bin/rimraf.cmd +17 -0
- data/node_modules/.bin/rimraf.ps1 +28 -0
- data/node_modules/.package-lock.json +574 -0
- data/node_modules/@types/node/LICENSE +21 -0
- data/node_modules/@types/node/README.md +16 -0
- data/node_modules/@types/node/assert/strict.d.ts +8 -0
- data/node_modules/@types/node/assert.d.ts +912 -0
- data/node_modules/@types/node/async_hooks.d.ts +497 -0
- data/node_modules/@types/node/buffer.d.ts +2142 -0
- data/node_modules/@types/node/child_process.d.ts +1355 -0
- data/node_modules/@types/node/cluster.d.ts +414 -0
- data/node_modules/@types/node/console.d.ts +407 -0
- data/node_modules/@types/node/constants.d.ts +18 -0
- data/node_modules/@types/node/crypto.d.ts +3224 -0
- data/node_modules/@types/node/dgram.d.ts +545 -0
- data/node_modules/@types/node/diagnostics_channel.d.ts +128 -0
- data/node_modules/@types/node/dns/promises.d.ts +357 -0
- data/node_modules/@types/node/dns.d.ts +643 -0
- data/node_modules/@types/node/domain.d.ts +169 -0
- data/node_modules/@types/node/events.d.ts +623 -0
- data/node_modules/@types/node/fs/promises.d.ts +997 -0
- data/node_modules/@types/node/fs.d.ts +3723 -0
- data/node_modules/@types/node/globals.d.ts +285 -0
- data/node_modules/@types/node/globals.global.d.ts +1 -0
- data/node_modules/@types/node/http.d.ts +1358 -0
- data/node_modules/@types/node/http2.d.ts +2100 -0
- data/node_modules/@types/node/https.d.ts +391 -0
- data/node_modules/@types/node/index.d.ts +131 -0
- data/node_modules/@types/node/inspector.d.ts +2738 -0
- data/node_modules/@types/node/module.d.ts +114 -0
- data/node_modules/@types/node/net.d.ts +783 -0
- data/node_modules/@types/node/os.d.ts +455 -0
- data/node_modules/@types/node/package.json +230 -0
- data/node_modules/@types/node/path.d.ts +172 -0
- data/node_modules/@types/node/perf_hooks.d.ts +555 -0
- data/node_modules/@types/node/process.d.ts +1477 -0
- data/node_modules/@types/node/punycode.d.ts +117 -0
- data/node_modules/@types/node/querystring.d.ts +131 -0
- data/node_modules/@types/node/readline.d.ts +542 -0
- data/node_modules/@types/node/repl.d.ts +424 -0
- data/node_modules/@types/node/stream/consumers.d.ts +24 -0
- data/node_modules/@types/node/stream/promises.d.ts +42 -0
- data/node_modules/@types/node/stream/web.d.ts +6 -0
- data/node_modules/@types/node/stream.d.ts +1181 -0
- data/node_modules/@types/node/string_decoder.d.ts +67 -0
- data/node_modules/@types/node/timers/promises.d.ts +68 -0
- data/node_modules/@types/node/timers.d.ts +94 -0
- data/node_modules/@types/node/tls.d.ts +1019 -0
- data/node_modules/@types/node/trace_events.d.ts +161 -0
- data/node_modules/@types/node/tty.d.ts +206 -0
- data/node_modules/@types/node/url.d.ts +798 -0
- data/node_modules/@types/node/util.d.ts +1556 -0
- data/node_modules/@types/node/v8.d.ts +378 -0
- data/node_modules/@types/node/vm.d.ts +504 -0
- data/node_modules/@types/node/wasi.d.ts +153 -0
- data/node_modules/@types/node/worker_threads.d.ts +649 -0
- data/node_modules/@types/node/zlib.d.ts +517 -0
- data/node_modules/@types/yauzl/LICENSE +21 -0
- data/node_modules/@types/yauzl/README.md +16 -0
- data/node_modules/@types/yauzl/index.d.ts +98 -0
- data/node_modules/@types/yauzl/package.json +27 -0
- data/node_modules/agent-base/README.md +145 -0
- data/node_modules/agent-base/dist/src/index.d.ts +78 -0
- data/node_modules/agent-base/dist/src/index.js +203 -0
- data/node_modules/agent-base/dist/src/index.js.map +1 -0
- data/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- data/node_modules/agent-base/dist/src/promisify.js +18 -0
- data/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- data/node_modules/agent-base/package.json +64 -0
- data/node_modules/agent-base/src/index.ts +345 -0
- data/node_modules/agent-base/src/promisify.ts +33 -0
- data/node_modules/balanced-match/.github/FUNDING.yml +2 -0
- data/node_modules/balanced-match/LICENSE.md +21 -0
- data/node_modules/balanced-match/README.md +97 -0
- data/node_modules/balanced-match/index.js +62 -0
- data/node_modules/balanced-match/package.json +48 -0
- data/node_modules/base64-js/LICENSE +21 -0
- data/node_modules/base64-js/README.md +34 -0
- data/node_modules/base64-js/base64js.min.js +1 -0
- data/node_modules/base64-js/index.d.ts +3 -0
- data/node_modules/base64-js/index.js +150 -0
- data/node_modules/base64-js/package.json +47 -0
- data/node_modules/bl/.travis.yml +17 -0
- data/node_modules/bl/BufferList.js +396 -0
- data/node_modules/bl/LICENSE.md +13 -0
- data/node_modules/bl/README.md +247 -0
- data/node_modules/bl/bl.js +84 -0
- data/node_modules/bl/package.json +37 -0
- data/node_modules/bl/test/convert.js +21 -0
- data/node_modules/bl/test/indexOf.js +492 -0
- data/node_modules/bl/test/isBufferList.js +32 -0
- data/node_modules/bl/test/test.js +869 -0
- data/node_modules/brace-expansion/LICENSE +21 -0
- data/node_modules/brace-expansion/README.md +129 -0
- data/node_modules/brace-expansion/index.js +201 -0
- data/node_modules/brace-expansion/package.json +47 -0
- data/node_modules/buffer/AUTHORS.md +70 -0
- data/node_modules/buffer/LICENSE +21 -0
- data/node_modules/buffer/README.md +410 -0
- data/node_modules/buffer/index.d.ts +186 -0
- data/node_modules/buffer/index.js +1817 -0
- data/node_modules/buffer/package.json +96 -0
- data/node_modules/buffer-crc32/LICENSE +19 -0
- data/node_modules/buffer-crc32/README.md +47 -0
- data/node_modules/buffer-crc32/index.js +111 -0
- data/node_modules/buffer-crc32/package.json +39 -0
- data/node_modules/chownr/LICENSE +15 -0
- data/node_modules/chownr/README.md +3 -0
- data/node_modules/chownr/chownr.js +167 -0
- data/node_modules/chownr/package.json +29 -0
- data/node_modules/concat-map/.travis.yml +4 -0
- data/node_modules/concat-map/LICENSE +18 -0
- data/node_modules/concat-map/README.markdown +62 -0
- data/node_modules/concat-map/example/map.js +6 -0
- data/node_modules/concat-map/index.js +13 -0
- data/node_modules/concat-map/package.json +43 -0
- data/node_modules/concat-map/test/map.js +39 -0
- data/node_modules/debug/LICENSE +19 -0
- data/node_modules/debug/README.md +455 -0
- data/node_modules/debug/package.json +59 -0
- data/node_modules/debug/src/browser.js +269 -0
- data/node_modules/debug/src/common.js +261 -0
- data/node_modules/debug/src/index.js +10 -0
- data/node_modules/debug/src/node.js +263 -0
- data/node_modules/devtools-protocol/LICENSE +27 -0
- data/node_modules/devtools-protocol/README.md +12 -0
- data/node_modules/devtools-protocol/changelog.md +10491 -0
- data/node_modules/devtools-protocol/externs/protocol_externs.js +9734 -0
- data/node_modules/devtools-protocol/json/browser_protocol.json +20641 -0
- data/node_modules/devtools-protocol/json/js_protocol.json +3581 -0
- data/node_modules/devtools-protocol/package.json +18 -0
- data/node_modules/devtools-protocol/pdl/browser_protocol.pdl +9637 -0
- data/node_modules/devtools-protocol/pdl/js_protocol.pdl +1678 -0
- data/node_modules/devtools-protocol/types/protocol-mapping.d.ts +4321 -0
- data/node_modules/devtools-protocol/types/protocol-proxy-api.d.ts +3683 -0
- data/node_modules/devtools-protocol/types/protocol.d.ts +15538 -0
- data/node_modules/end-of-stream/LICENSE +21 -0
- data/node_modules/end-of-stream/README.md +54 -0
- data/node_modules/end-of-stream/index.js +94 -0
- data/node_modules/end-of-stream/package.json +37 -0
- data/node_modules/extract-zip/LICENSE +23 -0
- data/node_modules/extract-zip/cli.js +19 -0
- data/node_modules/extract-zip/index.d.ts +21 -0
- data/node_modules/extract-zip/index.js +173 -0
- data/node_modules/extract-zip/package.json +80 -0
- data/node_modules/extract-zip/readme.md +57 -0
- data/node_modules/fd-slicer/.npmignore +2 -0
- data/node_modules/fd-slicer/.travis.yml +7 -0
- data/node_modules/fd-slicer/CHANGELOG.md +49 -0
- data/node_modules/fd-slicer/LICENSE +21 -0
- data/node_modules/fd-slicer/README.md +199 -0
- data/node_modules/fd-slicer/index.js +296 -0
- data/node_modules/fd-slicer/package.json +36 -0
- data/node_modules/fd-slicer/test/test.js +350 -0
- data/node_modules/find-up/index.d.ts +137 -0
- data/node_modules/find-up/index.js +89 -0
- data/node_modules/find-up/license +9 -0
- data/node_modules/find-up/package.json +53 -0
- data/node_modules/find-up/readme.md +156 -0
- data/node_modules/fs-constants/LICENSE +21 -0
- data/node_modules/fs-constants/README.md +26 -0
- data/node_modules/fs-constants/browser.js +1 -0
- data/node_modules/fs-constants/index.js +1 -0
- data/node_modules/fs-constants/package.json +19 -0
- data/node_modules/fs.realpath/LICENSE +43 -0
- data/node_modules/fs.realpath/README.md +33 -0
- data/node_modules/fs.realpath/index.js +66 -0
- data/node_modules/fs.realpath/old.js +303 -0
- data/node_modules/fs.realpath/package.json +26 -0
- data/node_modules/get-stream/buffer-stream.js +52 -0
- data/node_modules/get-stream/index.d.ts +108 -0
- data/node_modules/get-stream/index.js +60 -0
- data/node_modules/get-stream/license +9 -0
- data/node_modules/get-stream/package.json +50 -0
- data/node_modules/get-stream/readme.md +124 -0
- data/node_modules/glob/LICENSE +21 -0
- data/node_modules/glob/README.md +375 -0
- data/node_modules/glob/changelog.md +67 -0
- data/node_modules/glob/common.js +234 -0
- data/node_modules/glob/glob.js +788 -0
- data/node_modules/glob/package.json +51 -0
- data/node_modules/glob/sync.js +484 -0
- data/node_modules/https-proxy-agent/README.md +137 -0
- data/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- data/node_modules/https-proxy-agent/dist/agent.js +180 -0
- data/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- data/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- data/node_modules/https-proxy-agent/dist/index.js +14 -0
- data/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- data/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- data/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- data/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- data/node_modules/https-proxy-agent/package.json +56 -0
- data/node_modules/ieee754/LICENSE +11 -0
- data/node_modules/ieee754/README.md +51 -0
- data/node_modules/ieee754/index.d.ts +10 -0
- data/node_modules/ieee754/index.js +85 -0
- data/node_modules/ieee754/package.json +52 -0
- data/node_modules/inflight/LICENSE +15 -0
- data/node_modules/inflight/README.md +37 -0
- data/node_modules/inflight/inflight.js +54 -0
- data/node_modules/inflight/package.json +29 -0
- data/node_modules/inherits/LICENSE +16 -0
- data/node_modules/inherits/README.md +42 -0
- data/node_modules/inherits/inherits.js +9 -0
- data/node_modules/inherits/inherits_browser.js +27 -0
- data/node_modules/inherits/package.json +29 -0
- data/node_modules/locate-path/index.d.ts +83 -0
- data/node_modules/locate-path/index.js +65 -0
- data/node_modules/locate-path/license +9 -0
- data/node_modules/locate-path/package.json +45 -0
- data/node_modules/locate-path/readme.md +122 -0
- data/node_modules/minimatch/LICENSE +15 -0
- data/node_modules/minimatch/README.md +209 -0
- data/node_modules/minimatch/minimatch.js +923 -0
- data/node_modules/minimatch/package.json +30 -0
- data/node_modules/minimist/.travis.yml +8 -0
- data/node_modules/minimist/LICENSE +18 -0
- data/node_modules/minimist/example/parse.js +2 -0
- data/node_modules/minimist/index.js +245 -0
- data/node_modules/minimist/package.json +45 -0
- data/node_modules/minimist/readme.markdown +95 -0
- data/node_modules/minimist/test/all_bool.js +32 -0
- data/node_modules/minimist/test/bool.js +178 -0
- data/node_modules/minimist/test/dash.js +31 -0
- data/node_modules/minimist/test/default_bool.js +35 -0
- data/node_modules/minimist/test/dotted.js +22 -0
- data/node_modules/minimist/test/kv_short.js +16 -0
- data/node_modules/minimist/test/long.js +31 -0
- data/node_modules/minimist/test/num.js +36 -0
- data/node_modules/minimist/test/parse.js +197 -0
- data/node_modules/minimist/test/parse_modified.js +9 -0
- data/node_modules/minimist/test/proto.js +44 -0
- data/node_modules/minimist/test/short.js +67 -0
- data/node_modules/minimist/test/stop_early.js +15 -0
- data/node_modules/minimist/test/unknown.js +102 -0
- data/node_modules/minimist/test/whitespace.js +8 -0
- data/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/mkdirp/bin/cmd.js +33 -0
- data/node_modules/mkdirp/bin/usage.txt +12 -0
- data/node_modules/mkdirp/index.js +99 -0
- data/node_modules/mkdirp/package.json +34 -0
- data/node_modules/mkdirp/readme.markdown +100 -0
- data/node_modules/ms/index.js +162 -0
- data/node_modules/ms/license.md +21 -0
- data/node_modules/ms/package.json +37 -0
- data/node_modules/ms/readme.md +60 -0
- data/node_modules/node-fetch/CHANGELOG.md +272 -0
- data/node_modules/node-fetch/LICENSE.md +22 -0
- data/node_modules/node-fetch/README.md +590 -0
- data/node_modules/node-fetch/browser.js +25 -0
- data/node_modules/node-fetch/lib/index.es.js +1640 -0
- data/node_modules/node-fetch/lib/index.js +1649 -0
- data/node_modules/node-fetch/lib/index.mjs +1638 -0
- data/node_modules/node-fetch/package.json +66 -0
- data/node_modules/once/LICENSE +15 -0
- data/node_modules/once/README.md +79 -0
- data/node_modules/once/once.js +42 -0
- data/node_modules/once/package.json +33 -0
- data/node_modules/p-limit/index.d.ts +38 -0
- data/node_modules/p-limit/index.js +57 -0
- data/node_modules/p-limit/license +9 -0
- data/node_modules/p-limit/package.json +52 -0
- data/node_modules/p-limit/readme.md +101 -0
- data/node_modules/p-locate/index.d.ts +64 -0
- data/node_modules/p-locate/index.js +52 -0
- data/node_modules/p-locate/license +9 -0
- data/node_modules/p-locate/package.json +53 -0
- data/node_modules/p-locate/readme.md +90 -0
- data/node_modules/p-try/index.d.ts +39 -0
- data/node_modules/p-try/index.js +9 -0
- data/node_modules/p-try/license +9 -0
- data/node_modules/p-try/package.json +42 -0
- data/node_modules/p-try/readme.md +58 -0
- data/node_modules/path-exists/index.d.ts +28 -0
- data/node_modules/path-exists/index.js +23 -0
- data/node_modules/path-exists/license +9 -0
- data/node_modules/path-exists/package.json +39 -0
- data/node_modules/path-exists/readme.md +52 -0
- data/node_modules/path-is-absolute/index.js +20 -0
- data/node_modules/path-is-absolute/license +21 -0
- data/node_modules/path-is-absolute/package.json +43 -0
- data/node_modules/path-is-absolute/readme.md +59 -0
- data/node_modules/pend/LICENSE +23 -0
- data/node_modules/pend/README.md +41 -0
- data/node_modules/pend/index.js +55 -0
- data/node_modules/pend/package.json +18 -0
- data/node_modules/pend/test.js +137 -0
- data/node_modules/pkg-dir/index.d.ts +44 -0
- data/node_modules/pkg-dir/index.js +17 -0
- data/node_modules/pkg-dir/license +9 -0
- data/node_modules/pkg-dir/package.json +56 -0
- data/node_modules/pkg-dir/readme.md +66 -0
- data/node_modules/progress/CHANGELOG.md +115 -0
- data/node_modules/progress/LICENSE +22 -0
- data/node_modules/progress/Makefile +8 -0
- data/node_modules/progress/Readme.md +146 -0
- data/node_modules/progress/index.js +1 -0
- data/node_modules/progress/lib/node-progress.js +235 -0
- data/node_modules/progress/package.json +26 -0
- data/node_modules/proxy-from-env/.eslintrc +29 -0
- data/node_modules/proxy-from-env/.travis.yml +10 -0
- data/node_modules/proxy-from-env/LICENSE +20 -0
- data/node_modules/proxy-from-env/README.md +131 -0
- data/node_modules/proxy-from-env/index.js +108 -0
- data/node_modules/proxy-from-env/package.json +34 -0
- data/node_modules/proxy-from-env/test.js +483 -0
- data/node_modules/pump/.travis.yml +5 -0
- data/node_modules/pump/LICENSE +21 -0
- data/node_modules/pump/README.md +65 -0
- data/node_modules/pump/index.js +82 -0
- data/node_modules/pump/package.json +24 -0
- data/node_modules/pump/test-browser.js +66 -0
- data/node_modules/pump/test-node.js +53 -0
- data/node_modules/puppeteer-core/CHANGELOG.md +226 -0
- data/node_modules/puppeteer-core/LICENSE +202 -0
- data/node_modules/puppeteer-core/README.md +483 -0
- data/node_modules/puppeteer-core/cjs-entry-core.js +29 -0
- data/node_modules/puppeteer-core/cjs-entry.js +29 -0
- data/node_modules/puppeteer-core/install.js +89 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.d.ts +111 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.js +81 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/api-docs-entry.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.d.ts +176 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js +361 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Accessibility.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.d.ts +21 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.js +85 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/AriaQueryHandler.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.d.ts +438 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js +528 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Browser.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.d.ts +54 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.js +98 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.d.ts +26 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.js +35 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/BrowserWebSocketTransport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.d.ts +130 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js +281 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.d.ts +25 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.js +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConnectionTransport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +73 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.js +65 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.d.ts +189 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.js +329 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Coverage.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.d.ts +173 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js +655 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DOMWorld.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.d.ts +53 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.js +82 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Debug.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts +41 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.js +951 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/DeviceDescriptors.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.d.ts +75 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.js +98 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Dialog.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.d.ts +25 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.js +38 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EmulationManager.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.d.ts +42 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.js +49 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Errors.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.d.ts +61 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.js +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EvalTypes.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.d.ts +93 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js +117 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.d.ts +82 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.js +87 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Events.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.d.ts +194 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js +322 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/ExecutionContext.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.d.ts +59 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.js +72 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FileChooser.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.d.ts +733 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js +965 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/FrameManager.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts +341 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js +547 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPRequest.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.d.ts +126 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js +155 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/HTTPResponse.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.d.ts +360 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js +545 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Input.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.d.ts +469 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js +803 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/JSHandle.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts +66 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js +149 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/LifecycleWatcher.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.d.ts +27 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.js +34 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkConditions.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.d.ts +97 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js +341 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NetworkManager.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.d.ts +157 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.js +35 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PDFOptions.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.d.ts +2011 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js +2427 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.d.ts +21 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.js +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Product.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.d.ts +160 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.js +162 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Puppeteer.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts +52 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.js +3 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/PuppeteerViewport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.d.ts +65 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.js +166 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/QueryHandler.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.d.ts +61 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.js +77 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/SecurityDetails.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.d.ts +99 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.js +145 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Target.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.d.ts +28 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.js +48 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/TimeoutSettings.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.d.ts +47 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.js +104 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Tracing.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts +40 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.js +407 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/USKeyboardLayout.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.d.ts +99 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.js +113 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/WebWorker.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.d.ts +22 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.js +29 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/assert.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.d.ts +17 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.js +44 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/fetch.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.d.ts +85 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.js +328 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/common/helper.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.d.ts +17 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.js +20 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/environment.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.js +45 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-node.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.js +27 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/initialize-web.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.d.ts +134 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js +502 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserFetcher.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.d.ts +40 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js +225 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/BrowserRunner.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.d.ts +131 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/LaunchOptions.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.d.ts +17 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js +574 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Launcher.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts +27 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js +42 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/NodeWebSocketTransport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.d.ts +30 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.js +65 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/PipeTransport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.d.ts +154 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.js +189 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/Puppeteer.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.js +160 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node/install.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.js +25 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node-puppeteer-core.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js +24 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.d.ts +22 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.js +23 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/revisions.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.js +24 -0
- data/node_modules/puppeteer-core/lib/cjs/puppeteer/web.js.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.d.ts +28 -0
- data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js +57 -0
- data/node_modules/puppeteer-core/lib/cjs/vendor/mitt/src/index.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.d.ts +111 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.js +81 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/api-docs-entry.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.d.ts +176 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.js +357 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Accessibility.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.d.ts +21 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.js +82 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/AriaQueryHandler.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.d.ts +438 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.js +523 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Browser.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.d.ts +54 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js +75 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts +26 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.js +31 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/BrowserWebSocketTransport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.d.ts +130 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js +276 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Connection.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.d.ts +25 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.js +17 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConnectionTransport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.d.ts +73 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.js +61 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.d.ts +189 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.js +323 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Coverage.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.d.ts +173 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.js +650 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DOMWorld.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.d.ts +53 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.js +78 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Debug.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.d.ts +41 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.js +948 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/DeviceDescriptors.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.d.ts +75 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.js +94 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Dialog.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.d.ts +25 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.js +34 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EmulationManager.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.d.ts +42 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js +44 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Errors.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.d.ts +61 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.js +17 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EvalTypes.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.d.ts +93 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.js +110 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/EventEmitter.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.d.ts +82 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.js +84 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Events.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.d.ts +194 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js +318 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/ExecutionContext.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.d.ts +59 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.js +68 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FileChooser.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.d.ts +733 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js +960 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/FrameManager.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts +341 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js +543 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPRequest.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.d.ts +126 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js +151 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/HTTPResponse.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.d.ts +360 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.js +539 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Input.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.d.ts +469 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js +778 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/JSHandle.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.d.ts +66 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.js +145 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/LifecycleWatcher.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.d.ts +27 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.js +31 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkConditions.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.d.ts +97 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js +337 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/NetworkManager.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.d.ts +157 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.js +32 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PDFOptions.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.d.ts +2011 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js +2423 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Page.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.d.ts +21 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.js +17 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Product.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.d.ts +160 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.js +158 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Puppeteer.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.d.ts +52 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.js +2 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/PuppeteerViewport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.d.ts +65 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js +158 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/QueryHandler.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.d.ts +61 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.js +73 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/SecurityDetails.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.d.ts +99 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js +141 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Target.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.d.ts +28 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js +44 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/TimeoutSettings.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.d.ts +47 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.js +100 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/Tracing.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.d.ts +40 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.js +404 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/USKeyboardLayout.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.d.ts +99 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.js +109 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/WebWorker.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.d.ts +22 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.js +25 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/assert.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.d.ts +17 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.js +21 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/fetch.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.d.ts +85 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.js +306 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/common/helper.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.d.ts +17 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.js +17 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/environment.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.js +38 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-node.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js +23 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.d.ts +134 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.js +476 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserFetcher.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.d.ts +40 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js +199 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/BrowserRunner.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.d.ts +131 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.js +17 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/LaunchOptions.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.d.ts +17 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js +552 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Launcher.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts +27 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js +35 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/NodeWebSocketTransport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.d.ts +30 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.js +61 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/PipeTransport.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.d.ts +154 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.js +182 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/Puppeteer.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.js +152 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node/install.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.js +23 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node-puppeteer-core.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node.js +22 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/node.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.d.ts +22 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.js +20 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/revisions.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/web.d.ts +18 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/web.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/web.js +22 -0
- data/node_modules/puppeteer-core/lib/esm/puppeteer/web.js.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.d.ts +28 -0
- data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.d.ts.map +1 -0
- data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.js +54 -0
- data/node_modules/puppeteer-core/lib/esm/vendor/mitt/src/index.js.map +1 -0
- data/node_modules/puppeteer-core/lib/types.d.ts +6911 -0
- data/node_modules/puppeteer-core/package.json +122 -0
- data/node_modules/puppeteer-core/typescript-if-required.js +61 -0
- data/node_modules/readable-stream/CONTRIBUTING.md +38 -0
- data/node_modules/readable-stream/GOVERNANCE.md +136 -0
- data/node_modules/readable-stream/LICENSE +47 -0
- data/node_modules/readable-stream/README.md +106 -0
- data/node_modules/readable-stream/errors-browser.js +127 -0
- data/node_modules/readable-stream/errors.js +116 -0
- data/node_modules/readable-stream/experimentalWarning.js +17 -0
- data/node_modules/readable-stream/lib/_stream_duplex.js +139 -0
- data/node_modules/readable-stream/lib/_stream_passthrough.js +39 -0
- data/node_modules/readable-stream/lib/_stream_readable.js +1124 -0
- data/node_modules/readable-stream/lib/_stream_transform.js +201 -0
- data/node_modules/readable-stream/lib/_stream_writable.js +697 -0
- data/node_modules/readable-stream/lib/internal/streams/async_iterator.js +207 -0
- data/node_modules/readable-stream/lib/internal/streams/buffer_list.js +210 -0
- data/node_modules/readable-stream/lib/internal/streams/destroy.js +105 -0
- data/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +104 -0
- data/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- data/node_modules/readable-stream/lib/internal/streams/from.js +64 -0
- data/node_modules/readable-stream/lib/internal/streams/pipeline.js +97 -0
- data/node_modules/readable-stream/lib/internal/streams/state.js +27 -0
- data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +1 -0
- data/node_modules/readable-stream/lib/internal/streams/stream.js +1 -0
- data/node_modules/readable-stream/package.json +68 -0
- data/node_modules/readable-stream/readable-browser.js +9 -0
- data/node_modules/readable-stream/readable.js +16 -0
- data/node_modules/rimraf/CHANGELOG.md +65 -0
- data/node_modules/rimraf/LICENSE +15 -0
- data/node_modules/rimraf/README.md +101 -0
- data/node_modules/rimraf/bin.js +68 -0
- data/node_modules/rimraf/package.json +32 -0
- data/node_modules/rimraf/rimraf.js +360 -0
- data/node_modules/safe-buffer/LICENSE +21 -0
- data/node_modules/safe-buffer/README.md +584 -0
- data/node_modules/safe-buffer/index.d.ts +187 -0
- data/node_modules/safe-buffer/index.js +65 -0
- data/node_modules/safe-buffer/package.json +51 -0
- data/node_modules/string_decoder/LICENSE +48 -0
- data/node_modules/string_decoder/README.md +47 -0
- data/node_modules/string_decoder/lib/string_decoder.js +296 -0
- data/node_modules/string_decoder/package.json +34 -0
- data/node_modules/tar-fs/.travis.yml +5 -0
- data/node_modules/tar-fs/LICENSE +21 -0
- data/node_modules/tar-fs/README.md +163 -0
- data/node_modules/tar-fs/index.js +348 -0
- data/node_modules/tar-fs/package.json +41 -0
- data/node_modules/tar-fs/test/fixtures/a/hello.txt +1 -0
- data/node_modules/tar-fs/test/fixtures/b/a/test.txt +1 -0
- data/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
- data/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
- data/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
- data/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
- data/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
- data/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
- data/node_modules/tar-fs/test/fixtures/e/file +0 -0
- data/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
- data/node_modules/tar-fs/test/index.js +346 -0
- data/node_modules/tar-stream/LICENSE +21 -0
- data/node_modules/tar-stream/README.md +168 -0
- data/node_modules/tar-stream/extract.js +257 -0
- data/node_modules/tar-stream/headers.js +295 -0
- data/node_modules/tar-stream/index.js +2 -0
- data/node_modules/tar-stream/pack.js +255 -0
- data/node_modules/tar-stream/package.json +58 -0
- data/node_modules/tar-stream/sandbox.js +11 -0
- data/node_modules/through/.travis.yml +5 -0
- data/node_modules/through/LICENSE.APACHE2 +15 -0
- data/node_modules/through/LICENSE.MIT +24 -0
- data/node_modules/through/index.js +108 -0
- data/node_modules/through/package.json +36 -0
- data/node_modules/through/readme.markdown +64 -0
- data/node_modules/through/test/async.js +28 -0
- data/node_modules/through/test/auto-destroy.js +30 -0
- data/node_modules/through/test/buffering.js +71 -0
- data/node_modules/through/test/end.js +45 -0
- data/node_modules/through/test/index.js +133 -0
- data/node_modules/unbzip2-stream/LICENSE +24 -0
- data/node_modules/unbzip2-stream/README.md +59 -0
- data/node_modules/unbzip2-stream/dist/unbzip2-stream.min.js +1 -0
- data/node_modules/unbzip2-stream/index.js +92 -0
- data/node_modules/unbzip2-stream/lib/bit_iterator.js +39 -0
- data/node_modules/unbzip2-stream/lib/bzip2.js +367 -0
- data/node_modules/unbzip2-stream/package.json +51 -0
- data/node_modules/util-deprecate/History.md +16 -0
- data/node_modules/util-deprecate/LICENSE +24 -0
- data/node_modules/util-deprecate/README.md +53 -0
- data/node_modules/util-deprecate/browser.js +67 -0
- data/node_modules/util-deprecate/node.js +6 -0
- data/node_modules/util-deprecate/package.json +27 -0
- data/node_modules/wrappy/LICENSE +15 -0
- data/node_modules/wrappy/README.md +36 -0
- data/node_modules/wrappy/package.json +29 -0
- data/node_modules/wrappy/wrappy.js +33 -0
- data/node_modules/ws/LICENSE +21 -0
- data/node_modules/ws/README.md +496 -0
- data/node_modules/ws/browser.js +8 -0
- data/node_modules/ws/index.js +10 -0
- data/node_modules/ws/lib/buffer-util.js +129 -0
- data/node_modules/ws/lib/constants.js +10 -0
- data/node_modules/ws/lib/event-target.js +184 -0
- data/node_modules/ws/lib/extension.js +223 -0
- data/node_modules/ws/lib/limiter.js +55 -0
- data/node_modules/ws/lib/permessage-deflate.js +517 -0
- data/node_modules/ws/lib/receiver.js +507 -0
- data/node_modules/ws/lib/sender.js +405 -0
- data/node_modules/ws/lib/stream.js +165 -0
- data/node_modules/ws/lib/validation.js +104 -0
- data/node_modules/ws/lib/websocket-server.js +418 -0
- data/node_modules/ws/lib/websocket.js +942 -0
- data/node_modules/ws/package.json +56 -0
- data/node_modules/yauzl/LICENSE +21 -0
- data/node_modules/yauzl/README.md +658 -0
- data/node_modules/yauzl/index.js +796 -0
- data/node_modules/yauzl/package.json +40 -0
- data/package.json +6 -0
- metadata +940 -58
@@ -0,0 +1,3723 @@
|
|
1
|
+
/**
|
2
|
+
* The `fs` module enables interacting with the file system in a
|
3
|
+
* way modeled on standard POSIX functions.
|
4
|
+
*
|
5
|
+
* To use the promise-based APIs:
|
6
|
+
*
|
7
|
+
* ```js
|
8
|
+
* import * as fs from 'fs/promises';
|
9
|
+
* ```
|
10
|
+
*
|
11
|
+
* To use the callback and sync APIs:
|
12
|
+
*
|
13
|
+
* ```js
|
14
|
+
* import * as fs from 'fs';
|
15
|
+
* ```
|
16
|
+
*
|
17
|
+
* All file system operations have synchronous, callback, and promise-based
|
18
|
+
* forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM).
|
19
|
+
* @see [source](https://github.com/nodejs/node/blob/v16.7.0/lib/fs.js)
|
20
|
+
*/
|
21
|
+
declare module 'fs' {
|
22
|
+
import * as stream from 'node:stream';
|
23
|
+
import { Abortable, EventEmitter } from 'node:events';
|
24
|
+
import { URL } from 'node:url';
|
25
|
+
import * as promises from 'node:fs/promises';
|
26
|
+
export { promises };
|
27
|
+
/**
|
28
|
+
* Valid types for path values in "fs".
|
29
|
+
*/
|
30
|
+
export type PathLike = string | Buffer | URL;
|
31
|
+
export type PathOrFileDescriptor = PathLike | number;
|
32
|
+
export type TimeLike = string | number | Date;
|
33
|
+
export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void;
|
34
|
+
export type BufferEncodingOption =
|
35
|
+
| 'buffer'
|
36
|
+
| {
|
37
|
+
encoding: 'buffer';
|
38
|
+
};
|
39
|
+
export interface ObjectEncodingOptions {
|
40
|
+
encoding?: BufferEncoding | null | undefined;
|
41
|
+
}
|
42
|
+
export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null;
|
43
|
+
export type OpenMode = number | string;
|
44
|
+
export type Mode = number | string;
|
45
|
+
export interface StatsBase<T> {
|
46
|
+
isFile(): boolean;
|
47
|
+
isDirectory(): boolean;
|
48
|
+
isBlockDevice(): boolean;
|
49
|
+
isCharacterDevice(): boolean;
|
50
|
+
isSymbolicLink(): boolean;
|
51
|
+
isFIFO(): boolean;
|
52
|
+
isSocket(): boolean;
|
53
|
+
dev: T;
|
54
|
+
ino: T;
|
55
|
+
mode: T;
|
56
|
+
nlink: T;
|
57
|
+
uid: T;
|
58
|
+
gid: T;
|
59
|
+
rdev: T;
|
60
|
+
size: T;
|
61
|
+
blksize: T;
|
62
|
+
blocks: T;
|
63
|
+
atimeMs: T;
|
64
|
+
mtimeMs: T;
|
65
|
+
ctimeMs: T;
|
66
|
+
birthtimeMs: T;
|
67
|
+
atime: Date;
|
68
|
+
mtime: Date;
|
69
|
+
ctime: Date;
|
70
|
+
birthtime: Date;
|
71
|
+
}
|
72
|
+
export interface Stats extends StatsBase<number> {}
|
73
|
+
/**
|
74
|
+
* A `fs.Stats` object provides information about a file.
|
75
|
+
*
|
76
|
+
* Objects returned from {@link stat}, {@link lstat} and {@link fstat} and
|
77
|
+
* their synchronous counterparts are of this type.
|
78
|
+
* If `bigint` in the `options` passed to those methods is true, the numeric values
|
79
|
+
* will be `bigint` instead of `number`, and the object will contain additional
|
80
|
+
* nanosecond-precision properties suffixed with `Ns`.
|
81
|
+
*
|
82
|
+
* ```console
|
83
|
+
* Stats {
|
84
|
+
* dev: 2114,
|
85
|
+
* ino: 48064969,
|
86
|
+
* mode: 33188,
|
87
|
+
* nlink: 1,
|
88
|
+
* uid: 85,
|
89
|
+
* gid: 100,
|
90
|
+
* rdev: 0,
|
91
|
+
* size: 527,
|
92
|
+
* blksize: 4096,
|
93
|
+
* blocks: 8,
|
94
|
+
* atimeMs: 1318289051000.1,
|
95
|
+
* mtimeMs: 1318289051000.1,
|
96
|
+
* ctimeMs: 1318289051000.1,
|
97
|
+
* birthtimeMs: 1318289051000.1,
|
98
|
+
* atime: Mon, 10 Oct 2011 23:24:11 GMT,
|
99
|
+
* mtime: Mon, 10 Oct 2011 23:24:11 GMT,
|
100
|
+
* ctime: Mon, 10 Oct 2011 23:24:11 GMT,
|
101
|
+
* birthtime: Mon, 10 Oct 2011 23:24:11 GMT }
|
102
|
+
* ```
|
103
|
+
*
|
104
|
+
* `bigint` version:
|
105
|
+
*
|
106
|
+
* ```console
|
107
|
+
* BigIntStats {
|
108
|
+
* dev: 2114n,
|
109
|
+
* ino: 48064969n,
|
110
|
+
* mode: 33188n,
|
111
|
+
* nlink: 1n,
|
112
|
+
* uid: 85n,
|
113
|
+
* gid: 100n,
|
114
|
+
* rdev: 0n,
|
115
|
+
* size: 527n,
|
116
|
+
* blksize: 4096n,
|
117
|
+
* blocks: 8n,
|
118
|
+
* atimeMs: 1318289051000n,
|
119
|
+
* mtimeMs: 1318289051000n,
|
120
|
+
* ctimeMs: 1318289051000n,
|
121
|
+
* birthtimeMs: 1318289051000n,
|
122
|
+
* atimeNs: 1318289051000000000n,
|
123
|
+
* mtimeNs: 1318289051000000000n,
|
124
|
+
* ctimeNs: 1318289051000000000n,
|
125
|
+
* birthtimeNs: 1318289051000000000n,
|
126
|
+
* atime: Mon, 10 Oct 2011 23:24:11 GMT,
|
127
|
+
* mtime: Mon, 10 Oct 2011 23:24:11 GMT,
|
128
|
+
* ctime: Mon, 10 Oct 2011 23:24:11 GMT,
|
129
|
+
* birthtime: Mon, 10 Oct 2011 23:24:11 GMT }
|
130
|
+
* ```
|
131
|
+
* @since v0.1.21
|
132
|
+
*/
|
133
|
+
export class Stats {}
|
134
|
+
/**
|
135
|
+
* A representation of a directory entry, which can be a file or a subdirectory
|
136
|
+
* within the directory, as returned by reading from an `fs.Dir`. The
|
137
|
+
* directory entry is a combination of the file name and file type pairs.
|
138
|
+
*
|
139
|
+
* Additionally, when {@link readdir} or {@link readdirSync} is called with
|
140
|
+
* the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s.
|
141
|
+
* @since v10.10.0
|
142
|
+
*/
|
143
|
+
export class Dirent {
|
144
|
+
/**
|
145
|
+
* Returns `true` if the `fs.Dirent` object describes a regular file.
|
146
|
+
* @since v10.10.0
|
147
|
+
*/
|
148
|
+
isFile(): boolean;
|
149
|
+
/**
|
150
|
+
* Returns `true` if the `fs.Dirent` object describes a file system
|
151
|
+
* directory.
|
152
|
+
* @since v10.10.0
|
153
|
+
*/
|
154
|
+
isDirectory(): boolean;
|
155
|
+
/**
|
156
|
+
* Returns `true` if the `fs.Dirent` object describes a block device.
|
157
|
+
* @since v10.10.0
|
158
|
+
*/
|
159
|
+
isBlockDevice(): boolean;
|
160
|
+
/**
|
161
|
+
* Returns `true` if the `fs.Dirent` object describes a character device.
|
162
|
+
* @since v10.10.0
|
163
|
+
*/
|
164
|
+
isCharacterDevice(): boolean;
|
165
|
+
/**
|
166
|
+
* Returns `true` if the `fs.Dirent` object describes a symbolic link.
|
167
|
+
* @since v10.10.0
|
168
|
+
*/
|
169
|
+
isSymbolicLink(): boolean;
|
170
|
+
/**
|
171
|
+
* Returns `true` if the `fs.Dirent` object describes a first-in-first-out
|
172
|
+
* (FIFO) pipe.
|
173
|
+
* @since v10.10.0
|
174
|
+
*/
|
175
|
+
isFIFO(): boolean;
|
176
|
+
/**
|
177
|
+
* Returns `true` if the `fs.Dirent` object describes a socket.
|
178
|
+
* @since v10.10.0
|
179
|
+
*/
|
180
|
+
isSocket(): boolean;
|
181
|
+
/**
|
182
|
+
* The file name that this `fs.Dirent` object refers to. The type of this
|
183
|
+
* value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}.
|
184
|
+
* @since v10.10.0
|
185
|
+
*/
|
186
|
+
name: string;
|
187
|
+
}
|
188
|
+
/**
|
189
|
+
* A class representing a directory stream.
|
190
|
+
*
|
191
|
+
* Created by {@link opendir}, {@link opendirSync}, or `fsPromises.opendir()`.
|
192
|
+
*
|
193
|
+
* ```js
|
194
|
+
* import { opendir } from 'fs/promises';
|
195
|
+
*
|
196
|
+
* try {
|
197
|
+
* const dir = await opendir('./');
|
198
|
+
* for await (const dirent of dir)
|
199
|
+
* console.log(dirent.name);
|
200
|
+
* } catch (err) {
|
201
|
+
* console.error(err);
|
202
|
+
* }
|
203
|
+
* ```
|
204
|
+
*
|
205
|
+
* When using the async iterator, the `fs.Dir` object will be automatically
|
206
|
+
* closed after the iterator exits.
|
207
|
+
* @since v12.12.0
|
208
|
+
*/
|
209
|
+
export class Dir implements AsyncIterable<Dirent> {
|
210
|
+
/**
|
211
|
+
* The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`.
|
212
|
+
* @since v12.12.0
|
213
|
+
*/
|
214
|
+
readonly path: string;
|
215
|
+
/**
|
216
|
+
* Asynchronously iterates over the directory via `readdir(3)` until all entries have been read.
|
217
|
+
*/
|
218
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<Dirent>;
|
219
|
+
/**
|
220
|
+
* Asynchronously close the directory's underlying resource handle.
|
221
|
+
* Subsequent reads will result in errors.
|
222
|
+
*
|
223
|
+
* A promise is returned that will be resolved after the resource has been
|
224
|
+
* closed.
|
225
|
+
* @since v12.12.0
|
226
|
+
*/
|
227
|
+
close(): Promise<void>;
|
228
|
+
close(cb: NoParamCallback): void;
|
229
|
+
/**
|
230
|
+
* Synchronously close the directory's underlying resource handle.
|
231
|
+
* Subsequent reads will result in errors.
|
232
|
+
* @since v12.12.0
|
233
|
+
*/
|
234
|
+
closeSync(): void;
|
235
|
+
/**
|
236
|
+
* Asynchronously read the next directory entry via [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) as an `fs.Dirent`.
|
237
|
+
*
|
238
|
+
* A promise is returned that will be resolved with an `fs.Dirent`, or `null`if there are no more directory entries to read.
|
239
|
+
*
|
240
|
+
* Directory entries returned by this function are in no particular order as
|
241
|
+
* provided by the operating system's underlying directory mechanisms.
|
242
|
+
* Entries added or removed while iterating over the directory might not be
|
243
|
+
* included in the iteration results.
|
244
|
+
* @since v12.12.0
|
245
|
+
* @return containing {fs.Dirent|null}
|
246
|
+
*/
|
247
|
+
read(): Promise<Dirent | null>;
|
248
|
+
read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void;
|
249
|
+
/**
|
250
|
+
* Synchronously read the next directory entry as an `fs.Dirent`. See the
|
251
|
+
* POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more detail.
|
252
|
+
*
|
253
|
+
* If there are no more directory entries to read, `null` will be returned.
|
254
|
+
*
|
255
|
+
* Directory entries returned by this function are in no particular order as
|
256
|
+
* provided by the operating system's underlying directory mechanisms.
|
257
|
+
* Entries added or removed while iterating over the directory might not be
|
258
|
+
* included in the iteration results.
|
259
|
+
* @since v12.12.0
|
260
|
+
*/
|
261
|
+
readSync(): Dirent | null;
|
262
|
+
}
|
263
|
+
export interface FSWatcher extends EventEmitter {
|
264
|
+
/**
|
265
|
+
* Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable.
|
266
|
+
* @since v0.5.8
|
267
|
+
*/
|
268
|
+
close(): void;
|
269
|
+
/**
|
270
|
+
* events.EventEmitter
|
271
|
+
* 1. change
|
272
|
+
* 2. error
|
273
|
+
*/
|
274
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
275
|
+
addListener(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this;
|
276
|
+
addListener(event: 'error', listener: (error: Error) => void): this;
|
277
|
+
addListener(event: 'close', listener: () => void): this;
|
278
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
279
|
+
on(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this;
|
280
|
+
on(event: 'error', listener: (error: Error) => void): this;
|
281
|
+
on(event: 'close', listener: () => void): this;
|
282
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
283
|
+
once(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this;
|
284
|
+
once(event: 'error', listener: (error: Error) => void): this;
|
285
|
+
once(event: 'close', listener: () => void): this;
|
286
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
287
|
+
prependListener(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this;
|
288
|
+
prependListener(event: 'error', listener: (error: Error) => void): this;
|
289
|
+
prependListener(event: 'close', listener: () => void): this;
|
290
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
291
|
+
prependOnceListener(event: 'change', listener: (eventType: string, filename: string | Buffer) => void): this;
|
292
|
+
prependOnceListener(event: 'error', listener: (error: Error) => void): this;
|
293
|
+
prependOnceListener(event: 'close', listener: () => void): this;
|
294
|
+
}
|
295
|
+
/**
|
296
|
+
* Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function.
|
297
|
+
* @since v0.1.93
|
298
|
+
*/
|
299
|
+
export class ReadStream extends stream.Readable {
|
300
|
+
close(): void;
|
301
|
+
/**
|
302
|
+
* The number of bytes that have been read so far.
|
303
|
+
* @since v6.4.0
|
304
|
+
*/
|
305
|
+
bytesRead: number;
|
306
|
+
/**
|
307
|
+
* The path to the file the stream is reading from as specified in the first
|
308
|
+
* argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a `Buffer`, then`readStream.path` will be a
|
309
|
+
* `Buffer`.
|
310
|
+
* @since v0.1.93
|
311
|
+
*/
|
312
|
+
path: string | Buffer;
|
313
|
+
/**
|
314
|
+
* This property is `true` if the underlying file has not been opened yet,
|
315
|
+
* i.e. before the `'ready'` event is emitted.
|
316
|
+
* @since v11.2.0, v10.16.0
|
317
|
+
*/
|
318
|
+
pending: boolean;
|
319
|
+
/**
|
320
|
+
* events.EventEmitter
|
321
|
+
* 1. open
|
322
|
+
* 2. close
|
323
|
+
* 3. ready
|
324
|
+
*/
|
325
|
+
addListener(event: 'close', listener: () => void): this;
|
326
|
+
addListener(event: 'data', listener: (chunk: Buffer | string) => void): this;
|
327
|
+
addListener(event: 'end', listener: () => void): this;
|
328
|
+
addListener(event: 'error', listener: (err: Error) => void): this;
|
329
|
+
addListener(event: 'open', listener: (fd: number) => void): this;
|
330
|
+
addListener(event: 'pause', listener: () => void): this;
|
331
|
+
addListener(event: 'readable', listener: () => void): this;
|
332
|
+
addListener(event: 'ready', listener: () => void): this;
|
333
|
+
addListener(event: 'resume', listener: () => void): this;
|
334
|
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
335
|
+
on(event: 'close', listener: () => void): this;
|
336
|
+
on(event: 'data', listener: (chunk: Buffer | string) => void): this;
|
337
|
+
on(event: 'end', listener: () => void): this;
|
338
|
+
on(event: 'error', listener: (err: Error) => void): this;
|
339
|
+
on(event: 'open', listener: (fd: number) => void): this;
|
340
|
+
on(event: 'pause', listener: () => void): this;
|
341
|
+
on(event: 'readable', listener: () => void): this;
|
342
|
+
on(event: 'ready', listener: () => void): this;
|
343
|
+
on(event: 'resume', listener: () => void): this;
|
344
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
345
|
+
once(event: 'close', listener: () => void): this;
|
346
|
+
once(event: 'data', listener: (chunk: Buffer | string) => void): this;
|
347
|
+
once(event: 'end', listener: () => void): this;
|
348
|
+
once(event: 'error', listener: (err: Error) => void): this;
|
349
|
+
once(event: 'open', listener: (fd: number) => void): this;
|
350
|
+
once(event: 'pause', listener: () => void): this;
|
351
|
+
once(event: 'readable', listener: () => void): this;
|
352
|
+
once(event: 'ready', listener: () => void): this;
|
353
|
+
once(event: 'resume', listener: () => void): this;
|
354
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
355
|
+
prependListener(event: 'close', listener: () => void): this;
|
356
|
+
prependListener(event: 'data', listener: (chunk: Buffer | string) => void): this;
|
357
|
+
prependListener(event: 'end', listener: () => void): this;
|
358
|
+
prependListener(event: 'error', listener: (err: Error) => void): this;
|
359
|
+
prependListener(event: 'open', listener: (fd: number) => void): this;
|
360
|
+
prependListener(event: 'pause', listener: () => void): this;
|
361
|
+
prependListener(event: 'readable', listener: () => void): this;
|
362
|
+
prependListener(event: 'ready', listener: () => void): this;
|
363
|
+
prependListener(event: 'resume', listener: () => void): this;
|
364
|
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
365
|
+
prependOnceListener(event: 'close', listener: () => void): this;
|
366
|
+
prependOnceListener(event: 'data', listener: (chunk: Buffer | string) => void): this;
|
367
|
+
prependOnceListener(event: 'end', listener: () => void): this;
|
368
|
+
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
369
|
+
prependOnceListener(event: 'open', listener: (fd: number) => void): this;
|
370
|
+
prependOnceListener(event: 'pause', listener: () => void): this;
|
371
|
+
prependOnceListener(event: 'readable', listener: () => void): this;
|
372
|
+
prependOnceListener(event: 'ready', listener: () => void): this;
|
373
|
+
prependOnceListener(event: 'resume', listener: () => void): this;
|
374
|
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
375
|
+
}
|
376
|
+
/**
|
377
|
+
* * Extends `stream.Writable`
|
378
|
+
*
|
379
|
+
* Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function.
|
380
|
+
* @since v0.1.93
|
381
|
+
*/
|
382
|
+
export class WriteStream extends stream.Writable {
|
383
|
+
/**
|
384
|
+
* Closes `writeStream`. Optionally accepts a
|
385
|
+
* callback that will be executed once the `writeStream`is closed.
|
386
|
+
* @since v0.9.4
|
387
|
+
*/
|
388
|
+
close(): void;
|
389
|
+
/**
|
390
|
+
* The number of bytes written so far. Does not include data that is still queued
|
391
|
+
* for writing.
|
392
|
+
* @since v0.4.7
|
393
|
+
*/
|
394
|
+
bytesWritten: number;
|
395
|
+
/**
|
396
|
+
* The path to the file the stream is writing to as specified in the first
|
397
|
+
* argument to {@link createWriteStream}. If `path` is passed as a string, then`writeStream.path` will be a string. If `path` is passed as a `Buffer`, then`writeStream.path` will be a
|
398
|
+
* `Buffer`.
|
399
|
+
* @since v0.1.93
|
400
|
+
*/
|
401
|
+
path: string | Buffer;
|
402
|
+
/**
|
403
|
+
* This property is `true` if the underlying file has not been opened yet,
|
404
|
+
* i.e. before the `'ready'` event is emitted.
|
405
|
+
* @since v11.2.0
|
406
|
+
*/
|
407
|
+
pending: boolean;
|
408
|
+
/**
|
409
|
+
* events.EventEmitter
|
410
|
+
* 1. open
|
411
|
+
* 2. close
|
412
|
+
* 3. ready
|
413
|
+
*/
|
414
|
+
addListener(event: 'close', listener: () => void): this;
|
415
|
+
addListener(event: 'drain', listener: () => void): this;
|
416
|
+
addListener(event: 'error', listener: (err: Error) => void): this;
|
417
|
+
addListener(event: 'finish', listener: () => void): this;
|
418
|
+
addListener(event: 'open', listener: (fd: number) => void): this;
|
419
|
+
addListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
420
|
+
addListener(event: 'ready', listener: () => void): this;
|
421
|
+
addListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
422
|
+
addListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
423
|
+
on(event: 'close', listener: () => void): this;
|
424
|
+
on(event: 'drain', listener: () => void): this;
|
425
|
+
on(event: 'error', listener: (err: Error) => void): this;
|
426
|
+
on(event: 'finish', listener: () => void): this;
|
427
|
+
on(event: 'open', listener: (fd: number) => void): this;
|
428
|
+
on(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
429
|
+
on(event: 'ready', listener: () => void): this;
|
430
|
+
on(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
431
|
+
on(event: string | symbol, listener: (...args: any[]) => void): this;
|
432
|
+
once(event: 'close', listener: () => void): this;
|
433
|
+
once(event: 'drain', listener: () => void): this;
|
434
|
+
once(event: 'error', listener: (err: Error) => void): this;
|
435
|
+
once(event: 'finish', listener: () => void): this;
|
436
|
+
once(event: 'open', listener: (fd: number) => void): this;
|
437
|
+
once(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
438
|
+
once(event: 'ready', listener: () => void): this;
|
439
|
+
once(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
440
|
+
once(event: string | symbol, listener: (...args: any[]) => void): this;
|
441
|
+
prependListener(event: 'close', listener: () => void): this;
|
442
|
+
prependListener(event: 'drain', listener: () => void): this;
|
443
|
+
prependListener(event: 'error', listener: (err: Error) => void): this;
|
444
|
+
prependListener(event: 'finish', listener: () => void): this;
|
445
|
+
prependListener(event: 'open', listener: (fd: number) => void): this;
|
446
|
+
prependListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
447
|
+
prependListener(event: 'ready', listener: () => void): this;
|
448
|
+
prependListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
449
|
+
prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
450
|
+
prependOnceListener(event: 'close', listener: () => void): this;
|
451
|
+
prependOnceListener(event: 'drain', listener: () => void): this;
|
452
|
+
prependOnceListener(event: 'error', listener: (err: Error) => void): this;
|
453
|
+
prependOnceListener(event: 'finish', listener: () => void): this;
|
454
|
+
prependOnceListener(event: 'open', listener: (fd: number) => void): this;
|
455
|
+
prependOnceListener(event: 'pipe', listener: (src: stream.Readable) => void): this;
|
456
|
+
prependOnceListener(event: 'ready', listener: () => void): this;
|
457
|
+
prependOnceListener(event: 'unpipe', listener: (src: stream.Readable) => void): this;
|
458
|
+
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
|
459
|
+
}
|
460
|
+
/**
|
461
|
+
* Asynchronously rename file at `oldPath` to the pathname provided
|
462
|
+
* as `newPath`. In the case that `newPath` already exists, it will
|
463
|
+
* be overwritten. If there is a directory at `newPath`, an error will
|
464
|
+
* be raised instead. No arguments other than a possible exception are
|
465
|
+
* given to the completion callback.
|
466
|
+
*
|
467
|
+
* See also: [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html).
|
468
|
+
*
|
469
|
+
* ```js
|
470
|
+
* import { rename } from 'fs';
|
471
|
+
*
|
472
|
+
* rename('oldFile.txt', 'newFile.txt', (err) => {
|
473
|
+
* if (err) throw err;
|
474
|
+
* console.log('Rename complete!');
|
475
|
+
* });
|
476
|
+
* ```
|
477
|
+
* @since v0.0.2
|
478
|
+
*/
|
479
|
+
export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
|
480
|
+
export namespace rename {
|
481
|
+
/**
|
482
|
+
* Asynchronous rename(2) - Change the name or location of a file or directory.
|
483
|
+
* @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
484
|
+
* URL support is _experimental_.
|
485
|
+
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
486
|
+
* URL support is _experimental_.
|
487
|
+
*/
|
488
|
+
function __promisify__(oldPath: PathLike, newPath: PathLike): Promise<void>;
|
489
|
+
}
|
490
|
+
/**
|
491
|
+
* Renames the file from `oldPath` to `newPath`. Returns `undefined`.
|
492
|
+
*
|
493
|
+
* See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details.
|
494
|
+
* @since v0.1.21
|
495
|
+
*/
|
496
|
+
export function renameSync(oldPath: PathLike, newPath: PathLike): void;
|
497
|
+
/**
|
498
|
+
* Truncates the file. No arguments other than a possible exception are
|
499
|
+
* given to the completion callback. A file descriptor can also be passed as the
|
500
|
+
* first argument. In this case, `fs.ftruncate()` is called.
|
501
|
+
*
|
502
|
+
* ```js
|
503
|
+
* import { truncate } from 'fs';
|
504
|
+
* // Assuming that 'path/file.txt' is a regular file.
|
505
|
+
* truncate('path/file.txt', (err) => {
|
506
|
+
* if (err) throw err;
|
507
|
+
* console.log('path/file.txt was truncated');
|
508
|
+
* });
|
509
|
+
* ```
|
510
|
+
*
|
511
|
+
* Passing a file descriptor is deprecated and may result in an error being thrown
|
512
|
+
* in the future.
|
513
|
+
*
|
514
|
+
* See the POSIX [`truncate(2)`](http://man7.org/linux/man-pages/man2/truncate.2.html) documentation for more details.
|
515
|
+
* @since v0.8.6
|
516
|
+
* @param [len=0]
|
517
|
+
*/
|
518
|
+
export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void;
|
519
|
+
/**
|
520
|
+
* Asynchronous truncate(2) - Truncate a file to a specified length.
|
521
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
522
|
+
*/
|
523
|
+
export function truncate(path: PathLike, callback: NoParamCallback): void;
|
524
|
+
export namespace truncate {
|
525
|
+
/**
|
526
|
+
* Asynchronous truncate(2) - Truncate a file to a specified length.
|
527
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
528
|
+
* @param len If not specified, defaults to `0`.
|
529
|
+
*/
|
530
|
+
function __promisify__(path: PathLike, len?: number | null): Promise<void>;
|
531
|
+
}
|
532
|
+
/**
|
533
|
+
* Truncates the file. Returns `undefined`. A file descriptor can also be
|
534
|
+
* passed as the first argument. In this case, `fs.ftruncateSync()` is called.
|
535
|
+
*
|
536
|
+
* Passing a file descriptor is deprecated and may result in an error being thrown
|
537
|
+
* in the future.
|
538
|
+
* @since v0.8.6
|
539
|
+
* @param [len=0]
|
540
|
+
*/
|
541
|
+
export function truncateSync(path: PathLike, len?: number | null): void;
|
542
|
+
/**
|
543
|
+
* Truncates the file descriptor. No arguments other than a possible exception are
|
544
|
+
* given to the completion callback.
|
545
|
+
*
|
546
|
+
* See the POSIX [`ftruncate(2)`](http://man7.org/linux/man-pages/man2/ftruncate.2.html) documentation for more detail.
|
547
|
+
*
|
548
|
+
* If the file referred to by the file descriptor was larger than `len` bytes, only
|
549
|
+
* the first `len` bytes will be retained in the file.
|
550
|
+
*
|
551
|
+
* For example, the following program retains only the first four bytes of the
|
552
|
+
* file:
|
553
|
+
*
|
554
|
+
* ```js
|
555
|
+
* import { open, close, ftruncate } from 'fs';
|
556
|
+
*
|
557
|
+
* function closeFd(fd) {
|
558
|
+
* close(fd, (err) => {
|
559
|
+
* if (err) throw err;
|
560
|
+
* });
|
561
|
+
* }
|
562
|
+
*
|
563
|
+
* open('temp.txt', 'r+', (err, fd) => {
|
564
|
+
* if (err) throw err;
|
565
|
+
*
|
566
|
+
* try {
|
567
|
+
* ftruncate(fd, 4, (err) => {
|
568
|
+
* closeFd(fd);
|
569
|
+
* if (err) throw err;
|
570
|
+
* });
|
571
|
+
* } catch (err) {
|
572
|
+
* closeFd(fd);
|
573
|
+
* if (err) throw err;
|
574
|
+
* }
|
575
|
+
* });
|
576
|
+
* ```
|
577
|
+
*
|
578
|
+
* If the file previously was shorter than `len` bytes, it is extended, and the
|
579
|
+
* extended part is filled with null bytes (`'\0'`):
|
580
|
+
*
|
581
|
+
* If `len` is negative then `0` will be used.
|
582
|
+
* @since v0.8.6
|
583
|
+
* @param [len=0]
|
584
|
+
*/
|
585
|
+
export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void;
|
586
|
+
/**
|
587
|
+
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
588
|
+
* @param fd A file descriptor.
|
589
|
+
*/
|
590
|
+
export function ftruncate(fd: number, callback: NoParamCallback): void;
|
591
|
+
export namespace ftruncate {
|
592
|
+
/**
|
593
|
+
* Asynchronous ftruncate(2) - Truncate a file to a specified length.
|
594
|
+
* @param fd A file descriptor.
|
595
|
+
* @param len If not specified, defaults to `0`.
|
596
|
+
*/
|
597
|
+
function __promisify__(fd: number, len?: number | null): Promise<void>;
|
598
|
+
}
|
599
|
+
/**
|
600
|
+
* Truncates the file descriptor. Returns `undefined`.
|
601
|
+
*
|
602
|
+
* For detailed information, see the documentation of the asynchronous version of
|
603
|
+
* this API: {@link ftruncate}.
|
604
|
+
* @since v0.8.6
|
605
|
+
* @param [len=0]
|
606
|
+
*/
|
607
|
+
export function ftruncateSync(fd: number, len?: number | null): void;
|
608
|
+
/**
|
609
|
+
* Asynchronously changes owner and group of a file. No arguments other than a
|
610
|
+
* possible exception are given to the completion callback.
|
611
|
+
*
|
612
|
+
* See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
|
613
|
+
* @since v0.1.97
|
614
|
+
*/
|
615
|
+
export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
|
616
|
+
export namespace chown {
|
617
|
+
/**
|
618
|
+
* Asynchronous chown(2) - Change ownership of a file.
|
619
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
620
|
+
*/
|
621
|
+
function __promisify__(path: PathLike, uid: number, gid: number): Promise<void>;
|
622
|
+
}
|
623
|
+
/**
|
624
|
+
* Synchronously changes owner and group of a file. Returns `undefined`.
|
625
|
+
* This is the synchronous version of {@link chown}.
|
626
|
+
*
|
627
|
+
* See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail.
|
628
|
+
* @since v0.1.97
|
629
|
+
*/
|
630
|
+
export function chownSync(path: PathLike, uid: number, gid: number): void;
|
631
|
+
/**
|
632
|
+
* Sets the owner of the file. No arguments other than a possible exception are
|
633
|
+
* given to the completion callback.
|
634
|
+
*
|
635
|
+
* See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail.
|
636
|
+
* @since v0.4.7
|
637
|
+
*/
|
638
|
+
export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void;
|
639
|
+
export namespace fchown {
|
640
|
+
/**
|
641
|
+
* Asynchronous fchown(2) - Change ownership of a file.
|
642
|
+
* @param fd A file descriptor.
|
643
|
+
*/
|
644
|
+
function __promisify__(fd: number, uid: number, gid: number): Promise<void>;
|
645
|
+
}
|
646
|
+
/**
|
647
|
+
* Sets the owner of the file. Returns `undefined`.
|
648
|
+
*
|
649
|
+
* See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail.
|
650
|
+
* @since v0.4.7
|
651
|
+
* @param uid The file's new owner's user id.
|
652
|
+
* @param gid The file's new group's group id.
|
653
|
+
*/
|
654
|
+
export function fchownSync(fd: number, uid: number, gid: number): void;
|
655
|
+
/**
|
656
|
+
* Set the owner of the symbolic link. No arguments other than a possible
|
657
|
+
* exception are given to the completion callback.
|
658
|
+
*
|
659
|
+
* See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail.
|
660
|
+
*/
|
661
|
+
export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void;
|
662
|
+
export namespace lchown {
|
663
|
+
/**
|
664
|
+
* Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links.
|
665
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
666
|
+
*/
|
667
|
+
function __promisify__(path: PathLike, uid: number, gid: number): Promise<void>;
|
668
|
+
}
|
669
|
+
/**
|
670
|
+
* Set the owner for the path. Returns `undefined`.
|
671
|
+
*
|
672
|
+
* See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more details.
|
673
|
+
* @param uid The file's new owner's user id.
|
674
|
+
* @param gid The file's new group's group id.
|
675
|
+
*/
|
676
|
+
export function lchownSync(path: PathLike, uid: number, gid: number): void;
|
677
|
+
/**
|
678
|
+
* Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic
|
679
|
+
* link, then the link is not dereferenced: instead, the timestamps of the
|
680
|
+
* symbolic link itself are changed.
|
681
|
+
*
|
682
|
+
* No arguments other than a possible exception are given to the completion
|
683
|
+
* callback.
|
684
|
+
* @since v14.5.0, v12.19.0
|
685
|
+
*/
|
686
|
+
export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
687
|
+
export namespace lutimes {
|
688
|
+
/**
|
689
|
+
* Changes the access and modification times of a file in the same way as `fsPromises.utimes()`,
|
690
|
+
* with the difference that if the path refers to a symbolic link, then the link is not
|
691
|
+
* dereferenced: instead, the timestamps of the symbolic link itself are changed.
|
692
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
693
|
+
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
694
|
+
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
695
|
+
*/
|
696
|
+
function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
|
697
|
+
}
|
698
|
+
/**
|
699
|
+
* Change the file system timestamps of the symbolic link referenced by `path`.
|
700
|
+
* Returns `undefined`, or throws an exception when parameters are incorrect or
|
701
|
+
* the operation fails. This is the synchronous version of {@link lutimes}.
|
702
|
+
* @since v14.5.0, v12.19.0
|
703
|
+
*/
|
704
|
+
export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
|
705
|
+
/**
|
706
|
+
* Asynchronously changes the permissions of a file. No arguments other than a
|
707
|
+
* possible exception are given to the completion callback.
|
708
|
+
*
|
709
|
+
* See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail.
|
710
|
+
*
|
711
|
+
* ```js
|
712
|
+
* import { chmod } from 'fs';
|
713
|
+
*
|
714
|
+
* chmod('my_file.txt', 0o775, (err) => {
|
715
|
+
* if (err) throw err;
|
716
|
+
* console.log('The permissions for file "my_file.txt" have been changed!');
|
717
|
+
* });
|
718
|
+
* ```
|
719
|
+
* @since v0.1.30
|
720
|
+
*/
|
721
|
+
export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
|
722
|
+
export namespace chmod {
|
723
|
+
/**
|
724
|
+
* Asynchronous chmod(2) - Change permissions of a file.
|
725
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
726
|
+
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
727
|
+
*/
|
728
|
+
function __promisify__(path: PathLike, mode: Mode): Promise<void>;
|
729
|
+
}
|
730
|
+
/**
|
731
|
+
* For detailed information, see the documentation of the asynchronous version of
|
732
|
+
* this API: {@link chmod}.
|
733
|
+
*
|
734
|
+
* See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail.
|
735
|
+
* @since v0.6.7
|
736
|
+
*/
|
737
|
+
export function chmodSync(path: PathLike, mode: Mode): void;
|
738
|
+
/**
|
739
|
+
* Sets the permissions on the file. No arguments other than a possible exception
|
740
|
+
* are given to the completion callback.
|
741
|
+
*
|
742
|
+
* See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
|
743
|
+
* @since v0.4.7
|
744
|
+
*/
|
745
|
+
export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void;
|
746
|
+
export namespace fchmod {
|
747
|
+
/**
|
748
|
+
* Asynchronous fchmod(2) - Change permissions of a file.
|
749
|
+
* @param fd A file descriptor.
|
750
|
+
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
751
|
+
*/
|
752
|
+
function __promisify__(fd: number, mode: Mode): Promise<void>;
|
753
|
+
}
|
754
|
+
/**
|
755
|
+
* Sets the permissions on the file. Returns `undefined`.
|
756
|
+
*
|
757
|
+
* See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail.
|
758
|
+
* @since v0.4.7
|
759
|
+
*/
|
760
|
+
export function fchmodSync(fd: number, mode: Mode): void;
|
761
|
+
/**
|
762
|
+
* Changes the permissions on a symbolic link. No arguments other than a possible
|
763
|
+
* exception are given to the completion callback.
|
764
|
+
*
|
765
|
+
* This method is only implemented on macOS.
|
766
|
+
*
|
767
|
+
* See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
|
768
|
+
* @deprecated Since v0.4.7
|
769
|
+
*/
|
770
|
+
export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void;
|
771
|
+
export namespace lchmod {
|
772
|
+
/**
|
773
|
+
* Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links.
|
774
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
775
|
+
* @param mode A file mode. If a string is passed, it is parsed as an octal integer.
|
776
|
+
*/
|
777
|
+
function __promisify__(path: PathLike, mode: Mode): Promise<void>;
|
778
|
+
}
|
779
|
+
/**
|
780
|
+
* Changes the permissions on a symbolic link. Returns `undefined`.
|
781
|
+
*
|
782
|
+
* This method is only implemented on macOS.
|
783
|
+
*
|
784
|
+
* See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail.
|
785
|
+
* @deprecated Since v0.4.7
|
786
|
+
*/
|
787
|
+
export function lchmodSync(path: PathLike, mode: Mode): void;
|
788
|
+
/**
|
789
|
+
* Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object.
|
790
|
+
*
|
791
|
+
* In case of an error, the `err.code` will be one of `Common System Errors`.
|
792
|
+
*
|
793
|
+
* Using `fs.stat()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()` or `fs.writeFile()` is not recommended.
|
794
|
+
* Instead, user code should open/read/write the file directly and handle the
|
795
|
+
* error raised if the file is not available.
|
796
|
+
*
|
797
|
+
* To check if a file exists without manipulating it afterwards, {@link access} is recommended.
|
798
|
+
*
|
799
|
+
* For example, given the following directory structure:
|
800
|
+
*
|
801
|
+
* ```text
|
802
|
+
* - txtDir
|
803
|
+
* -- file.txt
|
804
|
+
* - app.js
|
805
|
+
* ```
|
806
|
+
*
|
807
|
+
* The next program will check for the stats of the given paths:
|
808
|
+
*
|
809
|
+
* ```js
|
810
|
+
* import { stat } from 'fs';
|
811
|
+
*
|
812
|
+
* const pathsToCheck = ['./txtDir', './txtDir/file.txt'];
|
813
|
+
*
|
814
|
+
* for (let i = 0; i < pathsToCheck.length; i++) {
|
815
|
+
* stat(pathsToCheck[i], (err, stats) => {
|
816
|
+
* console.log(stats.isDirectory());
|
817
|
+
* console.log(stats);
|
818
|
+
* });
|
819
|
+
* }
|
820
|
+
* ```
|
821
|
+
*
|
822
|
+
* The resulting output will resemble:
|
823
|
+
*
|
824
|
+
* ```console
|
825
|
+
* true
|
826
|
+
* Stats {
|
827
|
+
* dev: 16777220,
|
828
|
+
* mode: 16877,
|
829
|
+
* nlink: 3,
|
830
|
+
* uid: 501,
|
831
|
+
* gid: 20,
|
832
|
+
* rdev: 0,
|
833
|
+
* blksize: 4096,
|
834
|
+
* ino: 14214262,
|
835
|
+
* size: 96,
|
836
|
+
* blocks: 0,
|
837
|
+
* atimeMs: 1561174653071.963,
|
838
|
+
* mtimeMs: 1561174614583.3518,
|
839
|
+
* ctimeMs: 1561174626623.5366,
|
840
|
+
* birthtimeMs: 1561174126937.2893,
|
841
|
+
* atime: 2019-06-22T03:37:33.072Z,
|
842
|
+
* mtime: 2019-06-22T03:36:54.583Z,
|
843
|
+
* ctime: 2019-06-22T03:37:06.624Z,
|
844
|
+
* birthtime: 2019-06-22T03:28:46.937Z
|
845
|
+
* }
|
846
|
+
* false
|
847
|
+
* Stats {
|
848
|
+
* dev: 16777220,
|
849
|
+
* mode: 33188,
|
850
|
+
* nlink: 1,
|
851
|
+
* uid: 501,
|
852
|
+
* gid: 20,
|
853
|
+
* rdev: 0,
|
854
|
+
* blksize: 4096,
|
855
|
+
* ino: 14214074,
|
856
|
+
* size: 8,
|
857
|
+
* blocks: 8,
|
858
|
+
* atimeMs: 1561174616618.8555,
|
859
|
+
* mtimeMs: 1561174614584,
|
860
|
+
* ctimeMs: 1561174614583.8145,
|
861
|
+
* birthtimeMs: 1561174007710.7478,
|
862
|
+
* atime: 2019-06-22T03:36:56.619Z,
|
863
|
+
* mtime: 2019-06-22T03:36:54.584Z,
|
864
|
+
* ctime: 2019-06-22T03:36:54.584Z,
|
865
|
+
* birthtime: 2019-06-22T03:26:47.711Z
|
866
|
+
* }
|
867
|
+
* ```
|
868
|
+
* @since v0.0.2
|
869
|
+
*/
|
870
|
+
export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
871
|
+
export function stat(
|
872
|
+
path: PathLike,
|
873
|
+
options:
|
874
|
+
| (StatOptions & {
|
875
|
+
bigint?: false | undefined;
|
876
|
+
})
|
877
|
+
| undefined,
|
878
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void
|
879
|
+
): void;
|
880
|
+
export function stat(
|
881
|
+
path: PathLike,
|
882
|
+
options: StatOptions & {
|
883
|
+
bigint: true;
|
884
|
+
},
|
885
|
+
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void
|
886
|
+
): void;
|
887
|
+
export function stat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
888
|
+
export namespace stat {
|
889
|
+
/**
|
890
|
+
* Asynchronous stat(2) - Get file status.
|
891
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
892
|
+
*/
|
893
|
+
function __promisify__(
|
894
|
+
path: PathLike,
|
895
|
+
options?: StatOptions & {
|
896
|
+
bigint?: false | undefined;
|
897
|
+
}
|
898
|
+
): Promise<Stats>;
|
899
|
+
function __promisify__(
|
900
|
+
path: PathLike,
|
901
|
+
options: StatOptions & {
|
902
|
+
bigint: true;
|
903
|
+
}
|
904
|
+
): Promise<BigIntStats>;
|
905
|
+
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
906
|
+
}
|
907
|
+
export interface StatSyncFn<TDescriptor = PathLike> extends Function {
|
908
|
+
(path: TDescriptor, options?: undefined): Stats;
|
909
|
+
(
|
910
|
+
path: TDescriptor,
|
911
|
+
options?: StatOptions & {
|
912
|
+
bigint?: false | undefined;
|
913
|
+
throwIfNoEntry: false;
|
914
|
+
}
|
915
|
+
): Stats | undefined;
|
916
|
+
(
|
917
|
+
path: TDescriptor,
|
918
|
+
options: StatOptions & {
|
919
|
+
bigint: true;
|
920
|
+
throwIfNoEntry: false;
|
921
|
+
}
|
922
|
+
): BigIntStats | undefined;
|
923
|
+
(
|
924
|
+
path: TDescriptor,
|
925
|
+
options?: StatOptions & {
|
926
|
+
bigint?: false | undefined;
|
927
|
+
}
|
928
|
+
): Stats;
|
929
|
+
(
|
930
|
+
path: TDescriptor,
|
931
|
+
options: StatOptions & {
|
932
|
+
bigint: true;
|
933
|
+
}
|
934
|
+
): BigIntStats;
|
935
|
+
(
|
936
|
+
path: TDescriptor,
|
937
|
+
options: StatOptions & {
|
938
|
+
bigint: boolean;
|
939
|
+
throwIfNoEntry?: false | undefined;
|
940
|
+
}
|
941
|
+
): Stats | BigIntStats;
|
942
|
+
(path: TDescriptor, options?: StatOptions): Stats | BigIntStats | undefined;
|
943
|
+
}
|
944
|
+
/**
|
945
|
+
* Synchronous stat(2) - Get file status.
|
946
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
947
|
+
*/
|
948
|
+
export const statSync: StatSyncFn;
|
949
|
+
/**
|
950
|
+
* Invokes the callback with the `fs.Stats` for the file descriptor.
|
951
|
+
*
|
952
|
+
* See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail.
|
953
|
+
* @since v0.1.95
|
954
|
+
*/
|
955
|
+
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
956
|
+
export function fstat(
|
957
|
+
fd: number,
|
958
|
+
options:
|
959
|
+
| (StatOptions & {
|
960
|
+
bigint?: false | undefined;
|
961
|
+
})
|
962
|
+
| undefined,
|
963
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void
|
964
|
+
): void;
|
965
|
+
export function fstat(
|
966
|
+
fd: number,
|
967
|
+
options: StatOptions & {
|
968
|
+
bigint: true;
|
969
|
+
},
|
970
|
+
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void
|
971
|
+
): void;
|
972
|
+
export function fstat(fd: number, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
973
|
+
export namespace fstat {
|
974
|
+
/**
|
975
|
+
* Asynchronous fstat(2) - Get file status.
|
976
|
+
* @param fd A file descriptor.
|
977
|
+
*/
|
978
|
+
function __promisify__(
|
979
|
+
fd: number,
|
980
|
+
options?: StatOptions & {
|
981
|
+
bigint?: false | undefined;
|
982
|
+
}
|
983
|
+
): Promise<Stats>;
|
984
|
+
function __promisify__(
|
985
|
+
fd: number,
|
986
|
+
options: StatOptions & {
|
987
|
+
bigint: true;
|
988
|
+
}
|
989
|
+
): Promise<BigIntStats>;
|
990
|
+
function __promisify__(fd: number, options?: StatOptions): Promise<Stats | BigIntStats>;
|
991
|
+
}
|
992
|
+
/**
|
993
|
+
* Synchronous fstat(2) - Get file status.
|
994
|
+
* @param fd A file descriptor.
|
995
|
+
*/
|
996
|
+
export const fstatSync: StatSyncFn<number>;
|
997
|
+
/**
|
998
|
+
* Retrieves the `fs.Stats` for the symbolic link referred to by the path.
|
999
|
+
* The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic
|
1000
|
+
* link, then the link itself is stat-ed, not the file that it refers to.
|
1001
|
+
*
|
1002
|
+
* See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details.
|
1003
|
+
* @since v0.1.30
|
1004
|
+
*/
|
1005
|
+
export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
1006
|
+
export function lstat(
|
1007
|
+
path: PathLike,
|
1008
|
+
options:
|
1009
|
+
| (StatOptions & {
|
1010
|
+
bigint?: false | undefined;
|
1011
|
+
})
|
1012
|
+
| undefined,
|
1013
|
+
callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void
|
1014
|
+
): void;
|
1015
|
+
export function lstat(
|
1016
|
+
path: PathLike,
|
1017
|
+
options: StatOptions & {
|
1018
|
+
bigint: true;
|
1019
|
+
},
|
1020
|
+
callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void
|
1021
|
+
): void;
|
1022
|
+
export function lstat(path: PathLike, options: StatOptions | undefined, callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void): void;
|
1023
|
+
export namespace lstat {
|
1024
|
+
/**
|
1025
|
+
* Asynchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
1026
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1027
|
+
*/
|
1028
|
+
function __promisify__(
|
1029
|
+
path: PathLike,
|
1030
|
+
options?: StatOptions & {
|
1031
|
+
bigint?: false | undefined;
|
1032
|
+
}
|
1033
|
+
): Promise<Stats>;
|
1034
|
+
function __promisify__(
|
1035
|
+
path: PathLike,
|
1036
|
+
options: StatOptions & {
|
1037
|
+
bigint: true;
|
1038
|
+
}
|
1039
|
+
): Promise<BigIntStats>;
|
1040
|
+
function __promisify__(path: PathLike, options?: StatOptions): Promise<Stats | BigIntStats>;
|
1041
|
+
}
|
1042
|
+
/**
|
1043
|
+
* Synchronous lstat(2) - Get file status. Does not dereference symbolic links.
|
1044
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1045
|
+
*/
|
1046
|
+
export const lstatSync: StatSyncFn;
|
1047
|
+
/**
|
1048
|
+
* 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. No arguments other than a
|
1049
|
+
* possible
|
1050
|
+
* exception are given to the completion callback.
|
1051
|
+
* @since v0.1.31
|
1052
|
+
*/
|
1053
|
+
export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void;
|
1054
|
+
export namespace link {
|
1055
|
+
/**
|
1056
|
+
* Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file.
|
1057
|
+
* @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1058
|
+
* @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1059
|
+
*/
|
1060
|
+
function __promisify__(existingPath: PathLike, newPath: PathLike): Promise<void>;
|
1061
|
+
}
|
1062
|
+
/**
|
1063
|
+
* 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. Returns `undefined`.
|
1064
|
+
* @since v0.1.31
|
1065
|
+
*/
|
1066
|
+
export function linkSync(existingPath: PathLike, newPath: PathLike): void;
|
1067
|
+
/**
|
1068
|
+
* Creates the link called `path` pointing to `target`. No arguments other than a
|
1069
|
+
* possible exception are given to the completion callback.
|
1070
|
+
*
|
1071
|
+
* See the POSIX [`symlink(2)`](http://man7.org/linux/man-pages/man2/symlink.2.html) documentation for more details.
|
1072
|
+
*
|
1073
|
+
* The `type` argument is only available on Windows and ignored on other platforms.
|
1074
|
+
* It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is
|
1075
|
+
* not set, Node.js will autodetect `target` type and use `'file'` or `'dir'`. If
|
1076
|
+
* the `target` does not exist, `'file'` will be used. Windows junction points
|
1077
|
+
* require the destination path to be absolute. When using `'junction'`, the`target` argument will automatically be normalized to absolute path.
|
1078
|
+
*
|
1079
|
+
* Relative targets are relative to the link’s parent directory.
|
1080
|
+
*
|
1081
|
+
* ```js
|
1082
|
+
* import { symlink } from 'fs';
|
1083
|
+
*
|
1084
|
+
* symlink('./mew', './example/mewtwo', callback);
|
1085
|
+
* ```
|
1086
|
+
*
|
1087
|
+
* The above example creates a symbolic link `mewtwo` in the `example` which points
|
1088
|
+
* to `mew` in the same directory:
|
1089
|
+
*
|
1090
|
+
* ```bash
|
1091
|
+
* $ tree example/
|
1092
|
+
* example/
|
1093
|
+
* ├── mew
|
1094
|
+
* └── mewtwo -> ./mew
|
1095
|
+
* ```
|
1096
|
+
* @since v0.1.31
|
1097
|
+
*/
|
1098
|
+
export function symlink(target: PathLike, path: PathLike, type: symlink.Type | undefined | null, callback: NoParamCallback): void;
|
1099
|
+
/**
|
1100
|
+
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
1101
|
+
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
|
1102
|
+
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
|
1103
|
+
*/
|
1104
|
+
export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void;
|
1105
|
+
export namespace symlink {
|
1106
|
+
/**
|
1107
|
+
* Asynchronous symlink(2) - Create a new symbolic link to an existing file.
|
1108
|
+
* @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol.
|
1109
|
+
* @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol.
|
1110
|
+
* @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms).
|
1111
|
+
* When using `'junction'`, the `target` argument will automatically be normalized to an absolute path.
|
1112
|
+
*/
|
1113
|
+
function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise<void>;
|
1114
|
+
type Type = 'dir' | 'file' | 'junction';
|
1115
|
+
}
|
1116
|
+
/**
|
1117
|
+
* Returns `undefined`.
|
1118
|
+
*
|
1119
|
+
* For detailed information, see the documentation of the asynchronous version of
|
1120
|
+
* this API: {@link symlink}.
|
1121
|
+
* @since v0.1.31
|
1122
|
+
*/
|
1123
|
+
export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void;
|
1124
|
+
/**
|
1125
|
+
* Reads the contents of the symbolic link referred to by `path`. The callback gets
|
1126
|
+
* two arguments `(err, linkString)`.
|
1127
|
+
*
|
1128
|
+
* See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details.
|
1129
|
+
*
|
1130
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
1131
|
+
* object with an `encoding` property specifying the character encoding to use for
|
1132
|
+
* the link path passed to the callback. If the `encoding` is set to `'buffer'`,
|
1133
|
+
* the link path returned will be passed as a `Buffer` object.
|
1134
|
+
* @since v0.1.31
|
1135
|
+
*/
|
1136
|
+
export function readlink(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void;
|
1137
|
+
/**
|
1138
|
+
* Asynchronous readlink(2) - read value of a symbolic link.
|
1139
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1140
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1141
|
+
*/
|
1142
|
+
export function readlink(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void): void;
|
1143
|
+
/**
|
1144
|
+
* Asynchronous readlink(2) - read value of a symbolic link.
|
1145
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1146
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1147
|
+
*/
|
1148
|
+
export function readlink(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void): void;
|
1149
|
+
/**
|
1150
|
+
* Asynchronous readlink(2) - read value of a symbolic link.
|
1151
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1152
|
+
*/
|
1153
|
+
export function readlink(path: PathLike, callback: (err: NodeJS.ErrnoException | null, linkString: string) => void): void;
|
1154
|
+
export namespace readlink {
|
1155
|
+
/**
|
1156
|
+
* Asynchronous readlink(2) - read value of a symbolic link.
|
1157
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1158
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1159
|
+
*/
|
1160
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string>;
|
1161
|
+
/**
|
1162
|
+
* Asynchronous readlink(2) - read value of a symbolic link.
|
1163
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1164
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1165
|
+
*/
|
1166
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
|
1167
|
+
/**
|
1168
|
+
* Asynchronous readlink(2) - read value of a symbolic link.
|
1169
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1170
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1171
|
+
*/
|
1172
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
|
1173
|
+
}
|
1174
|
+
/**
|
1175
|
+
* Returns the symbolic link's string value.
|
1176
|
+
*
|
1177
|
+
* See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details.
|
1178
|
+
*
|
1179
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
1180
|
+
* object with an `encoding` property specifying the character encoding to use for
|
1181
|
+
* the link path returned. If the `encoding` is set to `'buffer'`,
|
1182
|
+
* the link path returned will be passed as a `Buffer` object.
|
1183
|
+
* @since v0.1.31
|
1184
|
+
*/
|
1185
|
+
export function readlinkSync(path: PathLike, options?: EncodingOption): string;
|
1186
|
+
/**
|
1187
|
+
* Synchronous readlink(2) - read value of a symbolic link.
|
1188
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1189
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1190
|
+
*/
|
1191
|
+
export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer;
|
1192
|
+
/**
|
1193
|
+
* Synchronous readlink(2) - read value of a symbolic link.
|
1194
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1195
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1196
|
+
*/
|
1197
|
+
export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer;
|
1198
|
+
/**
|
1199
|
+
* Asynchronously computes the canonical pathname by resolving `.`, `..` and
|
1200
|
+
* symbolic links.
|
1201
|
+
*
|
1202
|
+
* A canonical pathname is not necessarily unique. Hard links and bind mounts can
|
1203
|
+
* expose a file system entity through many pathnames.
|
1204
|
+
*
|
1205
|
+
* This function behaves like [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html), with some exceptions:
|
1206
|
+
*
|
1207
|
+
* 1. No case conversion is performed on case-insensitive file systems.
|
1208
|
+
* 2. The maximum number of symbolic links is platform-independent and generally
|
1209
|
+
* (much) higher than what the native [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html) implementation supports.
|
1210
|
+
*
|
1211
|
+
* The `callback` gets two arguments `(err, resolvedPath)`. May use `process.cwd`to resolve relative paths.
|
1212
|
+
*
|
1213
|
+
* Only paths that can be converted to UTF8 strings are supported.
|
1214
|
+
*
|
1215
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
1216
|
+
* object with an `encoding` property specifying the character encoding to use for
|
1217
|
+
* the path passed to the callback. If the `encoding` is set to `'buffer'`,
|
1218
|
+
* the path returned will be passed as a `Buffer` object.
|
1219
|
+
*
|
1220
|
+
* If `path` resolves to a socket or a pipe, the function will return a system
|
1221
|
+
* dependent name for that object.
|
1222
|
+
* @since v0.1.31
|
1223
|
+
*/
|
1224
|
+
export function realpath(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
1225
|
+
/**
|
1226
|
+
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
1227
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1228
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1229
|
+
*/
|
1230
|
+
export function realpath(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
|
1231
|
+
/**
|
1232
|
+
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
1233
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1234
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1235
|
+
*/
|
1236
|
+
export function realpath(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
|
1237
|
+
/**
|
1238
|
+
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
1239
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1240
|
+
*/
|
1241
|
+
export function realpath(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
1242
|
+
export namespace realpath {
|
1243
|
+
/**
|
1244
|
+
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
1245
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1246
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1247
|
+
*/
|
1248
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string>;
|
1249
|
+
/**
|
1250
|
+
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
1251
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1252
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1253
|
+
*/
|
1254
|
+
function __promisify__(path: PathLike, options: BufferEncodingOption): Promise<Buffer>;
|
1255
|
+
/**
|
1256
|
+
* Asynchronous realpath(3) - return the canonicalized absolute pathname.
|
1257
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1258
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1259
|
+
*/
|
1260
|
+
function __promisify__(path: PathLike, options?: EncodingOption): Promise<string | Buffer>;
|
1261
|
+
/**
|
1262
|
+
* Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html).
|
1263
|
+
*
|
1264
|
+
* The `callback` gets two arguments `(err, resolvedPath)`.
|
1265
|
+
*
|
1266
|
+
* Only paths that can be converted to UTF8 strings are supported.
|
1267
|
+
*
|
1268
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
1269
|
+
* object with an `encoding` property specifying the character encoding to use for
|
1270
|
+
* the path passed to the callback. If the `encoding` is set to `'buffer'`,
|
1271
|
+
* the path returned will be passed as a `Buffer` object.
|
1272
|
+
*
|
1273
|
+
* On Linux, when Node.js is linked against musl libc, the procfs file system must
|
1274
|
+
* be mounted on `/proc` in order for this function to work. Glibc does not have
|
1275
|
+
* this restriction.
|
1276
|
+
* @since v9.2.0
|
1277
|
+
*/
|
1278
|
+
function native(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
1279
|
+
function native(path: PathLike, options: BufferEncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void): void;
|
1280
|
+
function native(path: PathLike, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void): void;
|
1281
|
+
function native(path: PathLike, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void): void;
|
1282
|
+
}
|
1283
|
+
/**
|
1284
|
+
* Returns the resolved pathname.
|
1285
|
+
*
|
1286
|
+
* For detailed information, see the documentation of the asynchronous version of
|
1287
|
+
* this API: {@link realpath}.
|
1288
|
+
* @since v0.1.31
|
1289
|
+
*/
|
1290
|
+
export function realpathSync(path: PathLike, options?: EncodingOption): string;
|
1291
|
+
/**
|
1292
|
+
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
1293
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1294
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1295
|
+
*/
|
1296
|
+
export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer;
|
1297
|
+
/**
|
1298
|
+
* Synchronous realpath(3) - return the canonicalized absolute pathname.
|
1299
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1300
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1301
|
+
*/
|
1302
|
+
export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer;
|
1303
|
+
export namespace realpathSync {
|
1304
|
+
function native(path: PathLike, options?: EncodingOption): string;
|
1305
|
+
function native(path: PathLike, options: BufferEncodingOption): Buffer;
|
1306
|
+
function native(path: PathLike, options?: EncodingOption): string | Buffer;
|
1307
|
+
}
|
1308
|
+
/**
|
1309
|
+
* Asynchronously removes a file or symbolic link. No arguments other than a
|
1310
|
+
* possible exception are given to the completion callback.
|
1311
|
+
*
|
1312
|
+
* ```js
|
1313
|
+
* import { unlink } from 'fs';
|
1314
|
+
* // Assuming that 'path/file.txt' is a regular file.
|
1315
|
+
* unlink('path/file.txt', (err) => {
|
1316
|
+
* if (err) throw err;
|
1317
|
+
* console.log('path/file.txt was deleted');
|
1318
|
+
* });
|
1319
|
+
* ```
|
1320
|
+
*
|
1321
|
+
* `fs.unlink()` will not work on a directory, empty or otherwise. To remove a
|
1322
|
+
* directory, use {@link rmdir}.
|
1323
|
+
*
|
1324
|
+
* See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details.
|
1325
|
+
* @since v0.0.2
|
1326
|
+
*/
|
1327
|
+
export function unlink(path: PathLike, callback: NoParamCallback): void;
|
1328
|
+
export namespace unlink {
|
1329
|
+
/**
|
1330
|
+
* Asynchronous unlink(2) - delete a name and possibly the file it refers to.
|
1331
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1332
|
+
*/
|
1333
|
+
function __promisify__(path: PathLike): Promise<void>;
|
1334
|
+
}
|
1335
|
+
/**
|
1336
|
+
* Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`.
|
1337
|
+
* @since v0.1.21
|
1338
|
+
*/
|
1339
|
+
export function unlinkSync(path: PathLike): void;
|
1340
|
+
export interface RmDirOptions {
|
1341
|
+
/**
|
1342
|
+
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
1343
|
+
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
1344
|
+
* backoff wait of `retryDelay` ms longer on each try. This option represents the
|
1345
|
+
* number of retries. This option is ignored if the `recursive` option is not
|
1346
|
+
* `true`.
|
1347
|
+
* @default 0
|
1348
|
+
*/
|
1349
|
+
maxRetries?: number | undefined;
|
1350
|
+
/**
|
1351
|
+
* @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning
|
1352
|
+
* `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file.
|
1353
|
+
* Use `fs.rm(path, { recursive: true, force: true })` instead.
|
1354
|
+
*
|
1355
|
+
* If `true`, perform a recursive directory removal. In
|
1356
|
+
* recursive mode soperations are retried on failure.
|
1357
|
+
* @default false
|
1358
|
+
*/
|
1359
|
+
recursive?: boolean | undefined;
|
1360
|
+
/**
|
1361
|
+
* The amount of time in milliseconds to wait between retries.
|
1362
|
+
* This option is ignored if the `recursive` option is not `true`.
|
1363
|
+
* @default 100
|
1364
|
+
*/
|
1365
|
+
retryDelay?: number | undefined;
|
1366
|
+
}
|
1367
|
+
/**
|
1368
|
+
* Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given
|
1369
|
+
* to the completion callback.
|
1370
|
+
*
|
1371
|
+
* Using `fs.rmdir()` on a file (not a directory) results in an `ENOENT` error on
|
1372
|
+
* Windows and an `ENOTDIR` error on POSIX.
|
1373
|
+
*
|
1374
|
+
* To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`.
|
1375
|
+
* @since v0.0.2
|
1376
|
+
*/
|
1377
|
+
export function rmdir(path: PathLike, callback: NoParamCallback): void;
|
1378
|
+
export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void;
|
1379
|
+
export namespace rmdir {
|
1380
|
+
/**
|
1381
|
+
* Asynchronous rmdir(2) - delete a directory.
|
1382
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1383
|
+
*/
|
1384
|
+
function __promisify__(path: PathLike, options?: RmDirOptions): Promise<void>;
|
1385
|
+
}
|
1386
|
+
/**
|
1387
|
+
* Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`.
|
1388
|
+
*
|
1389
|
+
* Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error
|
1390
|
+
* on Windows and an `ENOTDIR` error on POSIX.
|
1391
|
+
*
|
1392
|
+
* To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`.
|
1393
|
+
* @since v0.1.21
|
1394
|
+
*/
|
1395
|
+
export function rmdirSync(path: PathLike, options?: RmDirOptions): void;
|
1396
|
+
export interface RmOptions {
|
1397
|
+
/**
|
1398
|
+
* When `true`, exceptions will be ignored if `path` does not exist.
|
1399
|
+
* @default false
|
1400
|
+
*/
|
1401
|
+
force?: boolean | undefined;
|
1402
|
+
/**
|
1403
|
+
* If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or
|
1404
|
+
* `EPERM` error is encountered, Node.js will retry the operation with a linear
|
1405
|
+
* backoff wait of `retryDelay` ms longer on each try. This option represents the
|
1406
|
+
* number of retries. This option is ignored if the `recursive` option is not
|
1407
|
+
* `true`.
|
1408
|
+
* @default 0
|
1409
|
+
*/
|
1410
|
+
maxRetries?: number | undefined;
|
1411
|
+
/**
|
1412
|
+
* If `true`, perform a recursive directory removal. In
|
1413
|
+
* recursive mode, operations are retried on failure.
|
1414
|
+
* @default false
|
1415
|
+
*/
|
1416
|
+
recursive?: boolean | undefined;
|
1417
|
+
/**
|
1418
|
+
* The amount of time in milliseconds to wait between retries.
|
1419
|
+
* This option is ignored if the `recursive` option is not `true`.
|
1420
|
+
* @default 100
|
1421
|
+
*/
|
1422
|
+
retryDelay?: number | undefined;
|
1423
|
+
}
|
1424
|
+
/**
|
1425
|
+
* Asynchronously removes files and directories (modeled on the standard POSIX `rm`utility). No arguments other than a possible exception are given to the
|
1426
|
+
* completion callback.
|
1427
|
+
* @since v14.14.0
|
1428
|
+
*/
|
1429
|
+
export function rm(path: PathLike, callback: NoParamCallback): void;
|
1430
|
+
export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void;
|
1431
|
+
export namespace rm {
|
1432
|
+
/**
|
1433
|
+
* Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility).
|
1434
|
+
*/
|
1435
|
+
function __promisify__(path: PathLike, options?: RmOptions): Promise<void>;
|
1436
|
+
}
|
1437
|
+
/**
|
1438
|
+
* Synchronously removes files and directories (modeled on the standard POSIX `rm`utility). Returns `undefined`.
|
1439
|
+
* @since v14.14.0
|
1440
|
+
*/
|
1441
|
+
export function rmSync(path: PathLike, options?: RmOptions): void;
|
1442
|
+
export interface MakeDirectoryOptions {
|
1443
|
+
/**
|
1444
|
+
* Indicates whether parent folders should be created.
|
1445
|
+
* If a folder was created, the path to the first created folder will be returned.
|
1446
|
+
* @default false
|
1447
|
+
*/
|
1448
|
+
recursive?: boolean | undefined;
|
1449
|
+
/**
|
1450
|
+
* A file mode. If a string is passed, it is parsed as an octal integer. If not specified
|
1451
|
+
* @default 0o777
|
1452
|
+
*/
|
1453
|
+
mode?: Mode | undefined;
|
1454
|
+
}
|
1455
|
+
/**
|
1456
|
+
* Asynchronously creates a directory.
|
1457
|
+
*
|
1458
|
+
* The callback is given a possible exception and, if `recursive` is `true`, the
|
1459
|
+
* first directory path created, `(err, [path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was
|
1460
|
+
* created.
|
1461
|
+
*
|
1462
|
+
* The optional `options` argument can be an integer specifying `mode` (permission
|
1463
|
+
* and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fs.mkdir()` when `path` is a directory that
|
1464
|
+
* exists results in an error only
|
1465
|
+
* when `recursive` is false.
|
1466
|
+
*
|
1467
|
+
* ```js
|
1468
|
+
* import { mkdir } from 'fs';
|
1469
|
+
*
|
1470
|
+
* // Creates /tmp/a/apple, regardless of whether `/tmp` and /tmp/a exist.
|
1471
|
+
* mkdir('/tmp/a/apple', { recursive: true }, (err) => {
|
1472
|
+
* if (err) throw err;
|
1473
|
+
* });
|
1474
|
+
* ```
|
1475
|
+
*
|
1476
|
+
* On Windows, using `fs.mkdir()` on the root directory even with recursion will
|
1477
|
+
* result in an error:
|
1478
|
+
*
|
1479
|
+
* ```js
|
1480
|
+
* import { mkdir } from 'fs';
|
1481
|
+
*
|
1482
|
+
* mkdir('/', { recursive: true }, (err) => {
|
1483
|
+
* // => [Error: EPERM: operation not permitted, mkdir 'C:\']
|
1484
|
+
* });
|
1485
|
+
* ```
|
1486
|
+
*
|
1487
|
+
* See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
|
1488
|
+
* @since v0.1.8
|
1489
|
+
*/
|
1490
|
+
export function mkdir(
|
1491
|
+
path: PathLike,
|
1492
|
+
options: MakeDirectoryOptions & {
|
1493
|
+
recursive: true;
|
1494
|
+
},
|
1495
|
+
callback: (err: NodeJS.ErrnoException | null, path?: string) => void
|
1496
|
+
): void;
|
1497
|
+
/**
|
1498
|
+
* Asynchronous mkdir(2) - create a directory.
|
1499
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1500
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
1501
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
1502
|
+
*/
|
1503
|
+
export function mkdir(
|
1504
|
+
path: PathLike,
|
1505
|
+
options:
|
1506
|
+
| Mode
|
1507
|
+
| (MakeDirectoryOptions & {
|
1508
|
+
recursive?: false | undefined;
|
1509
|
+
})
|
1510
|
+
| null
|
1511
|
+
| undefined,
|
1512
|
+
callback: NoParamCallback
|
1513
|
+
): void;
|
1514
|
+
/**
|
1515
|
+
* Asynchronous mkdir(2) - create a directory.
|
1516
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1517
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
1518
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
1519
|
+
*/
|
1520
|
+
export function mkdir(path: PathLike, options: Mode | MakeDirectoryOptions | null | undefined, callback: (err: NodeJS.ErrnoException | null, path?: string) => void): void;
|
1521
|
+
/**
|
1522
|
+
* Asynchronous mkdir(2) - create a directory with a mode of `0o777`.
|
1523
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1524
|
+
*/
|
1525
|
+
export function mkdir(path: PathLike, callback: NoParamCallback): void;
|
1526
|
+
export namespace mkdir {
|
1527
|
+
/**
|
1528
|
+
* Asynchronous mkdir(2) - create a directory.
|
1529
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1530
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
1531
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
1532
|
+
*/
|
1533
|
+
function __promisify__(
|
1534
|
+
path: PathLike,
|
1535
|
+
options: MakeDirectoryOptions & {
|
1536
|
+
recursive: true;
|
1537
|
+
}
|
1538
|
+
): Promise<string | undefined>;
|
1539
|
+
/**
|
1540
|
+
* Asynchronous mkdir(2) - create a directory.
|
1541
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1542
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
1543
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
1544
|
+
*/
|
1545
|
+
function __promisify__(
|
1546
|
+
path: PathLike,
|
1547
|
+
options?:
|
1548
|
+
| Mode
|
1549
|
+
| (MakeDirectoryOptions & {
|
1550
|
+
recursive?: false | undefined;
|
1551
|
+
})
|
1552
|
+
| null
|
1553
|
+
): Promise<void>;
|
1554
|
+
/**
|
1555
|
+
* Asynchronous mkdir(2) - create a directory.
|
1556
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1557
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
1558
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
1559
|
+
*/
|
1560
|
+
function __promisify__(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise<string | undefined>;
|
1561
|
+
}
|
1562
|
+
/**
|
1563
|
+
* Synchronously creates a directory. Returns `undefined`, or if `recursive` is`true`, the first directory path created.
|
1564
|
+
* This is the synchronous version of {@link mkdir}.
|
1565
|
+
*
|
1566
|
+
* See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details.
|
1567
|
+
* @since v0.1.21
|
1568
|
+
*/
|
1569
|
+
export function mkdirSync(
|
1570
|
+
path: PathLike,
|
1571
|
+
options: MakeDirectoryOptions & {
|
1572
|
+
recursive: true;
|
1573
|
+
}
|
1574
|
+
): string | undefined;
|
1575
|
+
/**
|
1576
|
+
* Synchronous mkdir(2) - create a directory.
|
1577
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1578
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
1579
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
1580
|
+
*/
|
1581
|
+
export function mkdirSync(
|
1582
|
+
path: PathLike,
|
1583
|
+
options?:
|
1584
|
+
| Mode
|
1585
|
+
| (MakeDirectoryOptions & {
|
1586
|
+
recursive?: false | undefined;
|
1587
|
+
})
|
1588
|
+
| null
|
1589
|
+
): void;
|
1590
|
+
/**
|
1591
|
+
* Synchronous mkdir(2) - create a directory.
|
1592
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1593
|
+
* @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders
|
1594
|
+
* should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`.
|
1595
|
+
*/
|
1596
|
+
export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined;
|
1597
|
+
/**
|
1598
|
+
* Creates a unique temporary directory.
|
1599
|
+
*
|
1600
|
+
* Generates six random characters to be appended behind a required`prefix` to create a unique temporary directory. Due to platform
|
1601
|
+
* inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms,
|
1602
|
+
* notably the BSDs, can return more than six random characters, and replace
|
1603
|
+
* trailing `X` characters in `prefix` with random characters.
|
1604
|
+
*
|
1605
|
+
* The created directory path is passed as a string to the callback's second
|
1606
|
+
* parameter.
|
1607
|
+
*
|
1608
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
1609
|
+
* object with an `encoding` property specifying the character encoding to use.
|
1610
|
+
*
|
1611
|
+
* ```js
|
1612
|
+
* import { mkdtemp } from 'fs';
|
1613
|
+
*
|
1614
|
+
* mkdtemp(path.join(os.tmpdir(), 'foo-'), (err, directory) => {
|
1615
|
+
* if (err) throw err;
|
1616
|
+
* console.log(directory);
|
1617
|
+
* // Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2
|
1618
|
+
* });
|
1619
|
+
* ```
|
1620
|
+
*
|
1621
|
+
* The `fs.mkdtemp()` method will append the six randomly selected characters
|
1622
|
+
* directly to the `prefix` string. For instance, given a directory `/tmp`, if the
|
1623
|
+
* intention is to create a temporary directory _within_`/tmp`, the `prefix`must end with a trailing platform-specific path separator
|
1624
|
+
* (`require('path').sep`).
|
1625
|
+
*
|
1626
|
+
* ```js
|
1627
|
+
* import { tmpdir } from 'os';
|
1628
|
+
* import { mkdtemp } from 'fs';
|
1629
|
+
*
|
1630
|
+
* // The parent directory for the new temporary directory
|
1631
|
+
* const tmpDir = tmpdir();
|
1632
|
+
*
|
1633
|
+
* // This method is *INCORRECT*:
|
1634
|
+
* mkdtemp(tmpDir, (err, directory) => {
|
1635
|
+
* if (err) throw err;
|
1636
|
+
* console.log(directory);
|
1637
|
+
* // Will print something similar to `/tmpabc123`.
|
1638
|
+
* // A new temporary directory is created at the file system root
|
1639
|
+
* // rather than *within* the /tmp directory.
|
1640
|
+
* });
|
1641
|
+
*
|
1642
|
+
* // This method is *CORRECT*:
|
1643
|
+
* import { sep } from 'path';
|
1644
|
+
* mkdtemp(`${tmpDir}${sep}`, (err, directory) => {
|
1645
|
+
* if (err) throw err;
|
1646
|
+
* console.log(directory);
|
1647
|
+
* // Will print something similar to `/tmp/abc123`.
|
1648
|
+
* // A new temporary directory is created within
|
1649
|
+
* // the /tmp directory.
|
1650
|
+
* });
|
1651
|
+
* ```
|
1652
|
+
* @since v5.10.0
|
1653
|
+
*/
|
1654
|
+
export function mkdtemp(prefix: string, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
|
1655
|
+
/**
|
1656
|
+
* Asynchronously creates a unique temporary directory.
|
1657
|
+
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
1658
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1659
|
+
*/
|
1660
|
+
export function mkdtemp(
|
1661
|
+
prefix: string,
|
1662
|
+
options:
|
1663
|
+
| 'buffer'
|
1664
|
+
| {
|
1665
|
+
encoding: 'buffer';
|
1666
|
+
},
|
1667
|
+
callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void
|
1668
|
+
): void;
|
1669
|
+
/**
|
1670
|
+
* Asynchronously creates a unique temporary directory.
|
1671
|
+
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
1672
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1673
|
+
*/
|
1674
|
+
export function mkdtemp(prefix: string, options: EncodingOption, callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void): void;
|
1675
|
+
/**
|
1676
|
+
* Asynchronously creates a unique temporary directory.
|
1677
|
+
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
1678
|
+
*/
|
1679
|
+
export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
|
1680
|
+
export namespace mkdtemp {
|
1681
|
+
/**
|
1682
|
+
* Asynchronously creates a unique temporary directory.
|
1683
|
+
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
1684
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1685
|
+
*/
|
1686
|
+
function __promisify__(prefix: string, options?: EncodingOption): Promise<string>;
|
1687
|
+
/**
|
1688
|
+
* Asynchronously creates a unique temporary directory.
|
1689
|
+
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
1690
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1691
|
+
*/
|
1692
|
+
function __promisify__(prefix: string, options: BufferEncodingOption): Promise<Buffer>;
|
1693
|
+
/**
|
1694
|
+
* Asynchronously creates a unique temporary directory.
|
1695
|
+
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
1696
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1697
|
+
*/
|
1698
|
+
function __promisify__(prefix: string, options?: EncodingOption): Promise<string | Buffer>;
|
1699
|
+
}
|
1700
|
+
/**
|
1701
|
+
* Returns the created directory path.
|
1702
|
+
*
|
1703
|
+
* For detailed information, see the documentation of the asynchronous version of
|
1704
|
+
* this API: {@link mkdtemp}.
|
1705
|
+
*
|
1706
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
1707
|
+
* object with an `encoding` property specifying the character encoding to use.
|
1708
|
+
* @since v5.10.0
|
1709
|
+
*/
|
1710
|
+
export function mkdtempSync(prefix: string, options?: EncodingOption): string;
|
1711
|
+
/**
|
1712
|
+
* Synchronously creates a unique temporary directory.
|
1713
|
+
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
1714
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1715
|
+
*/
|
1716
|
+
export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer;
|
1717
|
+
/**
|
1718
|
+
* Synchronously creates a unique temporary directory.
|
1719
|
+
* Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
|
1720
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1721
|
+
*/
|
1722
|
+
export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer;
|
1723
|
+
/**
|
1724
|
+
* Reads the contents of a directory. The callback gets two arguments `(err, files)`where `files` is an array of the names of the files in the directory excluding`'.'` and `'..'`.
|
1725
|
+
*
|
1726
|
+
* See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details.
|
1727
|
+
*
|
1728
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
1729
|
+
* object with an `encoding` property specifying the character encoding to use for
|
1730
|
+
* the filenames passed to the callback. If the `encoding` is set to `'buffer'`,
|
1731
|
+
* the filenames returned will be passed as `Buffer` objects.
|
1732
|
+
*
|
1733
|
+
* If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects.
|
1734
|
+
* @since v0.1.8
|
1735
|
+
*/
|
1736
|
+
export function readdir(
|
1737
|
+
path: PathLike,
|
1738
|
+
options:
|
1739
|
+
| {
|
1740
|
+
encoding: BufferEncoding | null;
|
1741
|
+
withFileTypes?: false | undefined;
|
1742
|
+
}
|
1743
|
+
| BufferEncoding
|
1744
|
+
| undefined
|
1745
|
+
| null,
|
1746
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[]) => void
|
1747
|
+
): void;
|
1748
|
+
/**
|
1749
|
+
* Asynchronous readdir(3) - read a directory.
|
1750
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1751
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1752
|
+
*/
|
1753
|
+
export function readdir(
|
1754
|
+
path: PathLike,
|
1755
|
+
options:
|
1756
|
+
| {
|
1757
|
+
encoding: 'buffer';
|
1758
|
+
withFileTypes?: false | undefined;
|
1759
|
+
}
|
1760
|
+
| 'buffer',
|
1761
|
+
callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void
|
1762
|
+
): void;
|
1763
|
+
/**
|
1764
|
+
* Asynchronous readdir(3) - read a directory.
|
1765
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1766
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1767
|
+
*/
|
1768
|
+
export function readdir(
|
1769
|
+
path: PathLike,
|
1770
|
+
options:
|
1771
|
+
| (ObjectEncodingOptions & {
|
1772
|
+
withFileTypes?: false | undefined;
|
1773
|
+
})
|
1774
|
+
| BufferEncoding
|
1775
|
+
| undefined
|
1776
|
+
| null,
|
1777
|
+
callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void
|
1778
|
+
): void;
|
1779
|
+
/**
|
1780
|
+
* Asynchronous readdir(3) - read a directory.
|
1781
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1782
|
+
*/
|
1783
|
+
export function readdir(path: PathLike, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void;
|
1784
|
+
/**
|
1785
|
+
* Asynchronous readdir(3) - read a directory.
|
1786
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1787
|
+
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
1788
|
+
*/
|
1789
|
+
export function readdir(
|
1790
|
+
path: PathLike,
|
1791
|
+
options: ObjectEncodingOptions & {
|
1792
|
+
withFileTypes: true;
|
1793
|
+
},
|
1794
|
+
callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void
|
1795
|
+
): void;
|
1796
|
+
export namespace readdir {
|
1797
|
+
/**
|
1798
|
+
* Asynchronous readdir(3) - read a directory.
|
1799
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1800
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1801
|
+
*/
|
1802
|
+
function __promisify__(
|
1803
|
+
path: PathLike,
|
1804
|
+
options?:
|
1805
|
+
| {
|
1806
|
+
encoding: BufferEncoding | null;
|
1807
|
+
withFileTypes?: false | undefined;
|
1808
|
+
}
|
1809
|
+
| BufferEncoding
|
1810
|
+
| null
|
1811
|
+
): Promise<string[]>;
|
1812
|
+
/**
|
1813
|
+
* Asynchronous readdir(3) - read a directory.
|
1814
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1815
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1816
|
+
*/
|
1817
|
+
function __promisify__(
|
1818
|
+
path: PathLike,
|
1819
|
+
options:
|
1820
|
+
| 'buffer'
|
1821
|
+
| {
|
1822
|
+
encoding: 'buffer';
|
1823
|
+
withFileTypes?: false | undefined;
|
1824
|
+
}
|
1825
|
+
): Promise<Buffer[]>;
|
1826
|
+
/**
|
1827
|
+
* Asynchronous readdir(3) - read a directory.
|
1828
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1829
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1830
|
+
*/
|
1831
|
+
function __promisify__(
|
1832
|
+
path: PathLike,
|
1833
|
+
options?:
|
1834
|
+
| (ObjectEncodingOptions & {
|
1835
|
+
withFileTypes?: false | undefined;
|
1836
|
+
})
|
1837
|
+
| BufferEncoding
|
1838
|
+
| null
|
1839
|
+
): Promise<string[] | Buffer[]>;
|
1840
|
+
/**
|
1841
|
+
* Asynchronous readdir(3) - read a directory.
|
1842
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1843
|
+
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent
|
1844
|
+
*/
|
1845
|
+
function __promisify__(
|
1846
|
+
path: PathLike,
|
1847
|
+
options: ObjectEncodingOptions & {
|
1848
|
+
withFileTypes: true;
|
1849
|
+
}
|
1850
|
+
): Promise<Dirent[]>;
|
1851
|
+
}
|
1852
|
+
/**
|
1853
|
+
* Reads the contents of the directory.
|
1854
|
+
*
|
1855
|
+
* See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details.
|
1856
|
+
*
|
1857
|
+
* The optional `options` argument can be a string specifying an encoding, or an
|
1858
|
+
* object with an `encoding` property specifying the character encoding to use for
|
1859
|
+
* the filenames returned. If the `encoding` is set to `'buffer'`,
|
1860
|
+
* the filenames returned will be passed as `Buffer` objects.
|
1861
|
+
*
|
1862
|
+
* If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects.
|
1863
|
+
* @since v0.1.21
|
1864
|
+
*/
|
1865
|
+
export function readdirSync(
|
1866
|
+
path: PathLike,
|
1867
|
+
options?:
|
1868
|
+
| {
|
1869
|
+
encoding: BufferEncoding | null;
|
1870
|
+
withFileTypes?: false | undefined;
|
1871
|
+
}
|
1872
|
+
| BufferEncoding
|
1873
|
+
| null
|
1874
|
+
): string[];
|
1875
|
+
/**
|
1876
|
+
* Synchronous readdir(3) - read a directory.
|
1877
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1878
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1879
|
+
*/
|
1880
|
+
export function readdirSync(
|
1881
|
+
path: PathLike,
|
1882
|
+
options:
|
1883
|
+
| {
|
1884
|
+
encoding: 'buffer';
|
1885
|
+
withFileTypes?: false | undefined;
|
1886
|
+
}
|
1887
|
+
| 'buffer'
|
1888
|
+
): Buffer[];
|
1889
|
+
/**
|
1890
|
+
* Synchronous readdir(3) - read a directory.
|
1891
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1892
|
+
* @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used.
|
1893
|
+
*/
|
1894
|
+
export function readdirSync(
|
1895
|
+
path: PathLike,
|
1896
|
+
options?:
|
1897
|
+
| (ObjectEncodingOptions & {
|
1898
|
+
withFileTypes?: false | undefined;
|
1899
|
+
})
|
1900
|
+
| BufferEncoding
|
1901
|
+
| null
|
1902
|
+
): string[] | Buffer[];
|
1903
|
+
/**
|
1904
|
+
* Synchronous readdir(3) - read a directory.
|
1905
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1906
|
+
* @param options If called with `withFileTypes: true` the result data will be an array of Dirent.
|
1907
|
+
*/
|
1908
|
+
export function readdirSync(
|
1909
|
+
path: PathLike,
|
1910
|
+
options: ObjectEncodingOptions & {
|
1911
|
+
withFileTypes: true;
|
1912
|
+
}
|
1913
|
+
): Dirent[];
|
1914
|
+
/**
|
1915
|
+
* Closes the file descriptor. No arguments other than a possible exception are
|
1916
|
+
* given to the completion callback.
|
1917
|
+
*
|
1918
|
+
* Calling `fs.close()` on any file descriptor (`fd`) that is currently in use
|
1919
|
+
* through any other `fs` operation may lead to undefined behavior.
|
1920
|
+
*
|
1921
|
+
* See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
|
1922
|
+
* @since v0.0.2
|
1923
|
+
*/
|
1924
|
+
export function close(fd: number, callback?: NoParamCallback): void;
|
1925
|
+
export namespace close {
|
1926
|
+
/**
|
1927
|
+
* Asynchronous close(2) - close a file descriptor.
|
1928
|
+
* @param fd A file descriptor.
|
1929
|
+
*/
|
1930
|
+
function __promisify__(fd: number): Promise<void>;
|
1931
|
+
}
|
1932
|
+
/**
|
1933
|
+
* Closes the file descriptor. Returns `undefined`.
|
1934
|
+
*
|
1935
|
+
* Calling `fs.closeSync()` on any file descriptor (`fd`) that is currently in use
|
1936
|
+
* through any other `fs` operation may lead to undefined behavior.
|
1937
|
+
*
|
1938
|
+
* See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail.
|
1939
|
+
* @since v0.1.21
|
1940
|
+
*/
|
1941
|
+
export function closeSync(fd: number): void;
|
1942
|
+
/**
|
1943
|
+
* Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details.
|
1944
|
+
*
|
1945
|
+
* `mode` sets the file mode (permission and sticky bits), but only if the file was
|
1946
|
+
* created. On Windows, only the write permission can be manipulated; see {@link chmod}.
|
1947
|
+
*
|
1948
|
+
* The callback gets two arguments `(err, fd)`.
|
1949
|
+
*
|
1950
|
+
* Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented
|
1951
|
+
* by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains
|
1952
|
+
* 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).
|
1953
|
+
*
|
1954
|
+
* Functions based on `fs.open()` exhibit this behavior as well:`fs.writeFile()`, `fs.readFile()`, etc.
|
1955
|
+
* @since v0.0.2
|
1956
|
+
* @param [flags='r'] See `support of file system `flags``.
|
1957
|
+
* @param [mode=0o666]
|
1958
|
+
*/
|
1959
|
+
export function open(path: PathLike, flags: OpenMode, mode: Mode | undefined | null, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
1960
|
+
/**
|
1961
|
+
* Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`.
|
1962
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1963
|
+
*/
|
1964
|
+
export function open(path: PathLike, flags: OpenMode, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
1965
|
+
export namespace open {
|
1966
|
+
/**
|
1967
|
+
* Asynchronous open(2) - open and possibly create a file.
|
1968
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1969
|
+
* @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`.
|
1970
|
+
*/
|
1971
|
+
function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise<number>;
|
1972
|
+
}
|
1973
|
+
/**
|
1974
|
+
* Returns an integer representing the file descriptor.
|
1975
|
+
*
|
1976
|
+
* For detailed information, see the documentation of the asynchronous version of
|
1977
|
+
* this API: {@link open}.
|
1978
|
+
* @since v0.1.21
|
1979
|
+
* @param [flags='r']
|
1980
|
+
* @param [mode=0o666]
|
1981
|
+
*/
|
1982
|
+
export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number;
|
1983
|
+
/**
|
1984
|
+
* Change the file system timestamps of the object referenced by `path`.
|
1985
|
+
*
|
1986
|
+
* The `atime` and `mtime` arguments follow these rules:
|
1987
|
+
*
|
1988
|
+
* * Values can be either numbers representing Unix epoch time in seconds,`Date`s, or a numeric string like `'123456789.0'`.
|
1989
|
+
* * If the value can not be converted to a number, or is `NaN`, `Infinity` or`-Infinity`, an `Error` will be thrown.
|
1990
|
+
* @since v0.4.2
|
1991
|
+
*/
|
1992
|
+
export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
1993
|
+
export namespace utimes {
|
1994
|
+
/**
|
1995
|
+
* Asynchronously change file timestamps of the file referenced by the supplied path.
|
1996
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
1997
|
+
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
1998
|
+
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
1999
|
+
*/
|
2000
|
+
function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise<void>;
|
2001
|
+
}
|
2002
|
+
/**
|
2003
|
+
* Returns `undefined`.
|
2004
|
+
*
|
2005
|
+
* For detailed information, see the documentation of the asynchronous version of
|
2006
|
+
* this API: {@link utimes}.
|
2007
|
+
* @since v0.4.2
|
2008
|
+
*/
|
2009
|
+
export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void;
|
2010
|
+
/**
|
2011
|
+
* Change the file system timestamps of the object referenced by the supplied file
|
2012
|
+
* descriptor. See {@link utimes}.
|
2013
|
+
* @since v0.4.2
|
2014
|
+
*/
|
2015
|
+
export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void;
|
2016
|
+
export namespace futimes {
|
2017
|
+
/**
|
2018
|
+
* Asynchronously change file timestamps of the file referenced by the supplied file descriptor.
|
2019
|
+
* @param fd A file descriptor.
|
2020
|
+
* @param atime The last access time. If a string is provided, it will be coerced to number.
|
2021
|
+
* @param mtime The last modified time. If a string is provided, it will be coerced to number.
|
2022
|
+
*/
|
2023
|
+
function __promisify__(fd: number, atime: TimeLike, mtime: TimeLike): Promise<void>;
|
2024
|
+
}
|
2025
|
+
/**
|
2026
|
+
* Synchronous version of {@link futimes}. Returns `undefined`.
|
2027
|
+
* @since v0.4.2
|
2028
|
+
*/
|
2029
|
+
export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void;
|
2030
|
+
/**
|
2031
|
+
* Request that all data for the open file descriptor is flushed to the storage
|
2032
|
+
* device. The specific implementation is operating system and device specific.
|
2033
|
+
* Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. No arguments other
|
2034
|
+
* than a possible exception are given to the completion callback.
|
2035
|
+
* @since v0.1.96
|
2036
|
+
*/
|
2037
|
+
export function fsync(fd: number, callback: NoParamCallback): void;
|
2038
|
+
export namespace fsync {
|
2039
|
+
/**
|
2040
|
+
* Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device.
|
2041
|
+
* @param fd A file descriptor.
|
2042
|
+
*/
|
2043
|
+
function __promisify__(fd: number): Promise<void>;
|
2044
|
+
}
|
2045
|
+
/**
|
2046
|
+
* Request that all data for the open file descriptor is flushed to the storage
|
2047
|
+
* device. The specific implementation is operating system and device specific.
|
2048
|
+
* Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`.
|
2049
|
+
* @since v0.1.96
|
2050
|
+
*/
|
2051
|
+
export function fsyncSync(fd: number): void;
|
2052
|
+
/**
|
2053
|
+
* Write `buffer` to the file specified by `fd`. If `buffer` is a normal object, it
|
2054
|
+
* must have an own `toString` function property.
|
2055
|
+
*
|
2056
|
+
* `offset` determines the part of the buffer to be written, and `length` is
|
2057
|
+
* an integer specifying the number of bytes to write.
|
2058
|
+
*
|
2059
|
+
* `position` refers to the offset from the beginning of the file where this data
|
2060
|
+
* should be written. If `typeof position !== 'number'`, the data will be written
|
2061
|
+
* at the current position. See [`pwrite(2)`](http://man7.org/linux/man-pages/man2/pwrite.2.html).
|
2062
|
+
*
|
2063
|
+
* The callback will be given three arguments `(err, bytesWritten, buffer)` where`bytesWritten` specifies how many _bytes_ were written from `buffer`.
|
2064
|
+
*
|
2065
|
+
* If this method is invoked as its `util.promisify()` ed version, it returns
|
2066
|
+
* a promise for an `Object` with `bytesWritten` and `buffer` properties.
|
2067
|
+
*
|
2068
|
+
* It is unsafe to use `fs.write()` multiple times on the same file without waiting
|
2069
|
+
* for the callback. For this scenario, {@link createWriteStream} is
|
2070
|
+
* recommended.
|
2071
|
+
*
|
2072
|
+
* On Linux, positional writes don't work when the file is opened in append mode.
|
2073
|
+
* The kernel ignores the position argument and always appends the data to
|
2074
|
+
* the end of the file.
|
2075
|
+
* @since v0.0.2
|
2076
|
+
*/
|
2077
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
2078
|
+
fd: number,
|
2079
|
+
buffer: TBuffer,
|
2080
|
+
offset: number | undefined | null,
|
2081
|
+
length: number | undefined | null,
|
2082
|
+
position: number | undefined | null,
|
2083
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
|
2084
|
+
): void;
|
2085
|
+
/**
|
2086
|
+
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
2087
|
+
* @param fd A file descriptor.
|
2088
|
+
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
|
2089
|
+
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
2090
|
+
*/
|
2091
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
2092
|
+
fd: number,
|
2093
|
+
buffer: TBuffer,
|
2094
|
+
offset: number | undefined | null,
|
2095
|
+
length: number | undefined | null,
|
2096
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
|
2097
|
+
): void;
|
2098
|
+
/**
|
2099
|
+
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
2100
|
+
* @param fd A file descriptor.
|
2101
|
+
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
|
2102
|
+
*/
|
2103
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(
|
2104
|
+
fd: number,
|
2105
|
+
buffer: TBuffer,
|
2106
|
+
offset: number | undefined | null,
|
2107
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void
|
2108
|
+
): void;
|
2109
|
+
/**
|
2110
|
+
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
2111
|
+
* @param fd A file descriptor.
|
2112
|
+
*/
|
2113
|
+
export function write<TBuffer extends NodeJS.ArrayBufferView>(fd: number, buffer: TBuffer, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void): void;
|
2114
|
+
/**
|
2115
|
+
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
2116
|
+
* @param fd A file descriptor.
|
2117
|
+
* @param string A string to write.
|
2118
|
+
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
2119
|
+
* @param encoding The expected string encoding.
|
2120
|
+
*/
|
2121
|
+
export function write(
|
2122
|
+
fd: number,
|
2123
|
+
string: string,
|
2124
|
+
position: number | undefined | null,
|
2125
|
+
encoding: BufferEncoding | undefined | null,
|
2126
|
+
callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void
|
2127
|
+
): void;
|
2128
|
+
/**
|
2129
|
+
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
2130
|
+
* @param fd A file descriptor.
|
2131
|
+
* @param string A string to write.
|
2132
|
+
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
2133
|
+
*/
|
2134
|
+
export function write(fd: number, string: string, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
|
2135
|
+
/**
|
2136
|
+
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
2137
|
+
* @param fd A file descriptor.
|
2138
|
+
* @param string A string to write.
|
2139
|
+
*/
|
2140
|
+
export function write(fd: number, string: string, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
|
2141
|
+
export namespace write {
|
2142
|
+
/**
|
2143
|
+
* Asynchronously writes `buffer` to the file referenced by the supplied file descriptor.
|
2144
|
+
* @param fd A file descriptor.
|
2145
|
+
* @param offset The part of the buffer to be written. If not supplied, defaults to `0`.
|
2146
|
+
* @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`.
|
2147
|
+
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
2148
|
+
*/
|
2149
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
2150
|
+
fd: number,
|
2151
|
+
buffer?: TBuffer,
|
2152
|
+
offset?: number,
|
2153
|
+
length?: number,
|
2154
|
+
position?: number | null
|
2155
|
+
): Promise<{
|
2156
|
+
bytesWritten: number;
|
2157
|
+
buffer: TBuffer;
|
2158
|
+
}>;
|
2159
|
+
/**
|
2160
|
+
* Asynchronously writes `string` to the file referenced by the supplied file descriptor.
|
2161
|
+
* @param fd A file descriptor.
|
2162
|
+
* @param string A string to write.
|
2163
|
+
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
2164
|
+
* @param encoding The expected string encoding.
|
2165
|
+
*/
|
2166
|
+
function __promisify__(
|
2167
|
+
fd: number,
|
2168
|
+
string: string,
|
2169
|
+
position?: number | null,
|
2170
|
+
encoding?: BufferEncoding | null
|
2171
|
+
): Promise<{
|
2172
|
+
bytesWritten: number;
|
2173
|
+
buffer: string;
|
2174
|
+
}>;
|
2175
|
+
}
|
2176
|
+
/**
|
2177
|
+
* If `buffer` is a plain object, it must have an own (not inherited) `toString`function property.
|
2178
|
+
*
|
2179
|
+
* For detailed information, see the documentation of the asynchronous version of
|
2180
|
+
* this API: {@link write}.
|
2181
|
+
* @since v0.1.21
|
2182
|
+
* @return The number of bytes written.
|
2183
|
+
*/
|
2184
|
+
export function writeSync(fd: number, buffer: NodeJS.ArrayBufferView, offset?: number | null, length?: number | null, position?: number | null): number;
|
2185
|
+
/**
|
2186
|
+
* Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written.
|
2187
|
+
* @param fd A file descriptor.
|
2188
|
+
* @param string A string to write.
|
2189
|
+
* @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.
|
2190
|
+
* @param encoding The expected string encoding.
|
2191
|
+
*/
|
2192
|
+
export function writeSync(fd: number, string: string, position?: number | null, encoding?: BufferEncoding | null): number;
|
2193
|
+
export type ReadPosition = number | bigint;
|
2194
|
+
/**
|
2195
|
+
* Read data from the file specified by `fd`.
|
2196
|
+
*
|
2197
|
+
* The callback is given the three arguments, `(err, bytesRead, buffer)`.
|
2198
|
+
*
|
2199
|
+
* If the file is not modified concurrently, the end-of-file is reached when the
|
2200
|
+
* number of bytes read is zero.
|
2201
|
+
*
|
2202
|
+
* If this method is invoked as its `util.promisify()` ed version, it returns
|
2203
|
+
* a promise for an `Object` with `bytesRead` and `buffer` properties.
|
2204
|
+
* @since v0.0.2
|
2205
|
+
* @param [buffer=Buffer.alloc(16384)] The buffer that the data will be written to.
|
2206
|
+
* @param [offset=0] The position in `buffer` to write the data to.
|
2207
|
+
* @param [length=buffer.byteLength] The number of bytes to read.
|
2208
|
+
* @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If
|
2209
|
+
* `position` is an integer, the file position will be unchanged.
|
2210
|
+
*/
|
2211
|
+
export function read<TBuffer extends NodeJS.ArrayBufferView>(
|
2212
|
+
fd: number,
|
2213
|
+
buffer: TBuffer,
|
2214
|
+
offset: number,
|
2215
|
+
length: number,
|
2216
|
+
position: ReadPosition | null,
|
2217
|
+
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void
|
2218
|
+
): void;
|
2219
|
+
export namespace read {
|
2220
|
+
/**
|
2221
|
+
* @param fd A file descriptor.
|
2222
|
+
* @param buffer The buffer that the data will be written to.
|
2223
|
+
* @param offset The offset in the buffer at which to start writing.
|
2224
|
+
* @param length The number of bytes to read.
|
2225
|
+
* @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position.
|
2226
|
+
*/
|
2227
|
+
function __promisify__<TBuffer extends NodeJS.ArrayBufferView>(
|
2228
|
+
fd: number,
|
2229
|
+
buffer: TBuffer,
|
2230
|
+
offset: number,
|
2231
|
+
length: number,
|
2232
|
+
position: number | null
|
2233
|
+
): Promise<{
|
2234
|
+
bytesRead: number;
|
2235
|
+
buffer: TBuffer;
|
2236
|
+
}>;
|
2237
|
+
}
|
2238
|
+
export interface ReadSyncOptions {
|
2239
|
+
/**
|
2240
|
+
* @default 0
|
2241
|
+
*/
|
2242
|
+
offset?: number | undefined;
|
2243
|
+
/**
|
2244
|
+
* @default `length of buffer`
|
2245
|
+
*/
|
2246
|
+
length?: number | undefined;
|
2247
|
+
/**
|
2248
|
+
* @default null
|
2249
|
+
*/
|
2250
|
+
position?: ReadPosition | null | undefined;
|
2251
|
+
}
|
2252
|
+
/**
|
2253
|
+
* Returns the number of `bytesRead`.
|
2254
|
+
*
|
2255
|
+
* For detailed information, see the documentation of the asynchronous version of
|
2256
|
+
* this API: {@link read}.
|
2257
|
+
* @since v0.1.21
|
2258
|
+
*/
|
2259
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, offset: number, length: number, position: ReadPosition | null): number;
|
2260
|
+
/**
|
2261
|
+
* Similar to the above `fs.readSync` function, this version takes an optional `options` object.
|
2262
|
+
* If no `options` object is specified, it will default with the above values.
|
2263
|
+
*/
|
2264
|
+
export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number;
|
2265
|
+
/**
|
2266
|
+
* Asynchronously reads the entire contents of a file.
|
2267
|
+
*
|
2268
|
+
* ```js
|
2269
|
+
* import { readFile } from 'fs';
|
2270
|
+
*
|
2271
|
+
* readFile('/etc/passwd', (err, data) => {
|
2272
|
+
* if (err) throw err;
|
2273
|
+
* console.log(data);
|
2274
|
+
* });
|
2275
|
+
* ```
|
2276
|
+
*
|
2277
|
+
* The callback is passed two arguments `(err, data)`, where `data` is the
|
2278
|
+
* contents of the file.
|
2279
|
+
*
|
2280
|
+
* If no encoding is specified, then the raw buffer is returned.
|
2281
|
+
*
|
2282
|
+
* If `options` is a string, then it specifies the encoding:
|
2283
|
+
*
|
2284
|
+
* ```js
|
2285
|
+
* import { readFile } from 'fs';
|
2286
|
+
*
|
2287
|
+
* readFile('/etc/passwd', 'utf8', callback);
|
2288
|
+
* ```
|
2289
|
+
*
|
2290
|
+
* When the path is a directory, the behavior of `fs.readFile()` and {@link readFileSync} is platform-specific. On macOS, Linux, and Windows, an
|
2291
|
+
* error will be returned. On FreeBSD, a representation of the directory's contents
|
2292
|
+
* will be returned.
|
2293
|
+
*
|
2294
|
+
* ```js
|
2295
|
+
* import { readFile } from 'fs';
|
2296
|
+
*
|
2297
|
+
* // macOS, Linux, and Windows
|
2298
|
+
* readFile('<directory>', (err, data) => {
|
2299
|
+
* // => [Error: EISDIR: illegal operation on a directory, read <directory>]
|
2300
|
+
* });
|
2301
|
+
*
|
2302
|
+
* // FreeBSD
|
2303
|
+
* readFile('<directory>', (err, data) => {
|
2304
|
+
* // => null, <data>
|
2305
|
+
* });
|
2306
|
+
* ```
|
2307
|
+
*
|
2308
|
+
* It is possible to abort an ongoing request using an `AbortSignal`. If a
|
2309
|
+
* request is aborted the callback is called with an `AbortError`:
|
2310
|
+
*
|
2311
|
+
* ```js
|
2312
|
+
* import { readFile } from 'fs';
|
2313
|
+
*
|
2314
|
+
* const controller = new AbortController();
|
2315
|
+
* const signal = controller.signal;
|
2316
|
+
* readFile(fileInfo[0].name, { signal }, (err, buf) => {
|
2317
|
+
* // ...
|
2318
|
+
* });
|
2319
|
+
* // When you want to abort the request
|
2320
|
+
* controller.abort();
|
2321
|
+
* ```
|
2322
|
+
*
|
2323
|
+
* The `fs.readFile()` function buffers the entire file. To minimize memory costs,
|
2324
|
+
* when possible prefer streaming via `fs.createReadStream()`.
|
2325
|
+
*
|
2326
|
+
* Aborting an ongoing request does not abort individual operating
|
2327
|
+
* system requests but rather the internal buffering `fs.readFile` performs.
|
2328
|
+
* @since v0.1.29
|
2329
|
+
* @param path filename or file descriptor
|
2330
|
+
*/
|
2331
|
+
export function readFile(
|
2332
|
+
path: PathOrFileDescriptor,
|
2333
|
+
options:
|
2334
|
+
| ({
|
2335
|
+
encoding?: null | undefined;
|
2336
|
+
flag?: string | undefined;
|
2337
|
+
} & Abortable)
|
2338
|
+
| undefined
|
2339
|
+
| null,
|
2340
|
+
callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void
|
2341
|
+
): void;
|
2342
|
+
/**
|
2343
|
+
* Asynchronously reads the entire contents of a file.
|
2344
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2345
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2346
|
+
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
2347
|
+
* If a flag is not provided, it defaults to `'r'`.
|
2348
|
+
*/
|
2349
|
+
export function readFile(
|
2350
|
+
path: PathOrFileDescriptor,
|
2351
|
+
options:
|
2352
|
+
| ({
|
2353
|
+
encoding: BufferEncoding;
|
2354
|
+
flag?: string | undefined;
|
2355
|
+
} & Abortable)
|
2356
|
+
| BufferEncoding,
|
2357
|
+
callback: (err: NodeJS.ErrnoException | null, data: string) => void
|
2358
|
+
): void;
|
2359
|
+
/**
|
2360
|
+
* Asynchronously reads the entire contents of a file.
|
2361
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2362
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2363
|
+
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
2364
|
+
* If a flag is not provided, it defaults to `'r'`.
|
2365
|
+
*/
|
2366
|
+
export function readFile(
|
2367
|
+
path: PathOrFileDescriptor,
|
2368
|
+
options:
|
2369
|
+
| (ObjectEncodingOptions & {
|
2370
|
+
flag?: string | undefined;
|
2371
|
+
} & Abortable)
|
2372
|
+
| BufferEncoding
|
2373
|
+
| undefined
|
2374
|
+
| null,
|
2375
|
+
callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void
|
2376
|
+
): void;
|
2377
|
+
/**
|
2378
|
+
* Asynchronously reads the entire contents of a file.
|
2379
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2380
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2381
|
+
*/
|
2382
|
+
export function readFile(path: PathOrFileDescriptor, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
|
2383
|
+
export namespace readFile {
|
2384
|
+
/**
|
2385
|
+
* Asynchronously reads the entire contents of a file.
|
2386
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2387
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2388
|
+
* @param options An object that may contain an optional flag.
|
2389
|
+
* If a flag is not provided, it defaults to `'r'`.
|
2390
|
+
*/
|
2391
|
+
function __promisify__(
|
2392
|
+
path: PathOrFileDescriptor,
|
2393
|
+
options?: {
|
2394
|
+
encoding?: null | undefined;
|
2395
|
+
flag?: string | undefined;
|
2396
|
+
} | null
|
2397
|
+
): Promise<Buffer>;
|
2398
|
+
/**
|
2399
|
+
* Asynchronously reads the entire contents of a file.
|
2400
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2401
|
+
* URL support is _experimental_.
|
2402
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2403
|
+
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
2404
|
+
* If a flag is not provided, it defaults to `'r'`.
|
2405
|
+
*/
|
2406
|
+
function __promisify__(
|
2407
|
+
path: PathOrFileDescriptor,
|
2408
|
+
options:
|
2409
|
+
| {
|
2410
|
+
encoding: BufferEncoding;
|
2411
|
+
flag?: string | undefined;
|
2412
|
+
}
|
2413
|
+
| BufferEncoding
|
2414
|
+
): Promise<string>;
|
2415
|
+
/**
|
2416
|
+
* Asynchronously reads the entire contents of a file.
|
2417
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2418
|
+
* URL support is _experimental_.
|
2419
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2420
|
+
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
2421
|
+
* If a flag is not provided, it defaults to `'r'`.
|
2422
|
+
*/
|
2423
|
+
function __promisify__(
|
2424
|
+
path: PathOrFileDescriptor,
|
2425
|
+
options?:
|
2426
|
+
| (ObjectEncodingOptions & {
|
2427
|
+
flag?: string | undefined;
|
2428
|
+
})
|
2429
|
+
| BufferEncoding
|
2430
|
+
| null
|
2431
|
+
): Promise<string | Buffer>;
|
2432
|
+
}
|
2433
|
+
/**
|
2434
|
+
* Returns the contents of the `path`.
|
2435
|
+
*
|
2436
|
+
* For detailed information, see the documentation of the asynchronous version of
|
2437
|
+
* this API: {@link readFile}.
|
2438
|
+
*
|
2439
|
+
* If the `encoding` option is specified then this function returns a
|
2440
|
+
* string. Otherwise it returns a buffer.
|
2441
|
+
*
|
2442
|
+
* Similar to {@link readFile}, when the path is a directory, the behavior of`fs.readFileSync()` is platform-specific.
|
2443
|
+
*
|
2444
|
+
* ```js
|
2445
|
+
* import { readFileSync } from 'fs';
|
2446
|
+
*
|
2447
|
+
* // macOS, Linux, and Windows
|
2448
|
+
* readFileSync('<directory>');
|
2449
|
+
* // => [Error: EISDIR: illegal operation on a directory, read <directory>]
|
2450
|
+
*
|
2451
|
+
* // FreeBSD
|
2452
|
+
* readFileSync('<directory>'); // => <data>
|
2453
|
+
* ```
|
2454
|
+
* @since v0.1.8
|
2455
|
+
* @param path filename or file descriptor
|
2456
|
+
*/
|
2457
|
+
export function readFileSync(
|
2458
|
+
path: PathOrFileDescriptor,
|
2459
|
+
options?: {
|
2460
|
+
encoding?: null | undefined;
|
2461
|
+
flag?: string | undefined;
|
2462
|
+
} | null
|
2463
|
+
): Buffer;
|
2464
|
+
/**
|
2465
|
+
* Synchronously reads the entire contents of a file.
|
2466
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2467
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2468
|
+
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
2469
|
+
* If a flag is not provided, it defaults to `'r'`.
|
2470
|
+
*/
|
2471
|
+
export function readFileSync(
|
2472
|
+
path: PathOrFileDescriptor,
|
2473
|
+
options:
|
2474
|
+
| {
|
2475
|
+
encoding: BufferEncoding;
|
2476
|
+
flag?: string | undefined;
|
2477
|
+
}
|
2478
|
+
| BufferEncoding
|
2479
|
+
): string;
|
2480
|
+
/**
|
2481
|
+
* Synchronously reads the entire contents of a file.
|
2482
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2483
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2484
|
+
* @param options Either the encoding for the result, or an object that contains the encoding and an optional flag.
|
2485
|
+
* If a flag is not provided, it defaults to `'r'`.
|
2486
|
+
*/
|
2487
|
+
export function readFileSync(
|
2488
|
+
path: PathOrFileDescriptor,
|
2489
|
+
options?:
|
2490
|
+
| (ObjectEncodingOptions & {
|
2491
|
+
flag?: string | undefined;
|
2492
|
+
})
|
2493
|
+
| BufferEncoding
|
2494
|
+
| null
|
2495
|
+
): string | Buffer;
|
2496
|
+
export type WriteFileOptions =
|
2497
|
+
| (ObjectEncodingOptions &
|
2498
|
+
Abortable & {
|
2499
|
+
mode?: Mode | undefined;
|
2500
|
+
flag?: string | undefined;
|
2501
|
+
})
|
2502
|
+
| BufferEncoding
|
2503
|
+
| null;
|
2504
|
+
/**
|
2505
|
+
* When `file` is a filename, asynchronously writes data to the file, replacing the
|
2506
|
+
* file if it already exists. `data` can be a string or a buffer.
|
2507
|
+
*
|
2508
|
+
* When `file` is a file descriptor, the behavior is similar to calling`fs.write()` directly (which is recommended). See the notes below on using
|
2509
|
+
* a file descriptor.
|
2510
|
+
*
|
2511
|
+
* The `encoding` option is ignored if `data` is a buffer.
|
2512
|
+
*
|
2513
|
+
* If `data` is a plain object, it must have an own (not inherited) `toString`function property.
|
2514
|
+
*
|
2515
|
+
* ```js
|
2516
|
+
* import { writeFile } from 'fs';
|
2517
|
+
* import { Buffer } from 'buffer';
|
2518
|
+
*
|
2519
|
+
* const data = new Uint8Array(Buffer.from('Hello Node.js'));
|
2520
|
+
* writeFile('message.txt', data, (err) => {
|
2521
|
+
* if (err) throw err;
|
2522
|
+
* console.log('The file has been saved!');
|
2523
|
+
* });
|
2524
|
+
* ```
|
2525
|
+
*
|
2526
|
+
* If `options` is a string, then it specifies the encoding:
|
2527
|
+
*
|
2528
|
+
* ```js
|
2529
|
+
* import { writeFile } from 'fs';
|
2530
|
+
*
|
2531
|
+
* writeFile('message.txt', 'Hello Node.js', 'utf8', callback);
|
2532
|
+
* ```
|
2533
|
+
*
|
2534
|
+
* It is unsafe to use `fs.writeFile()` multiple times on the same file without
|
2535
|
+
* waiting for the callback. For this scenario, {@link createWriteStream} is
|
2536
|
+
* recommended.
|
2537
|
+
*
|
2538
|
+
* Similarly to `fs.readFile` \- `fs.writeFile` is a convenience method that
|
2539
|
+
* performs multiple `write` calls internally to write the buffer passed to it.
|
2540
|
+
* For performance sensitive code consider using {@link createWriteStream}.
|
2541
|
+
*
|
2542
|
+
* It is possible to use an `AbortSignal` to cancel an `fs.writeFile()`.
|
2543
|
+
* Cancelation is "best effort", and some amount of data is likely still
|
2544
|
+
* to be written.
|
2545
|
+
*
|
2546
|
+
* ```js
|
2547
|
+
* import { writeFile } from 'fs';
|
2548
|
+
* import { Buffer } from 'buffer';
|
2549
|
+
*
|
2550
|
+
* const controller = new AbortController();
|
2551
|
+
* const { signal } = controller;
|
2552
|
+
* const data = new Uint8Array(Buffer.from('Hello Node.js'));
|
2553
|
+
* writeFile('message.txt', data, { signal }, (err) => {
|
2554
|
+
* // When a request is aborted - the callback is called with an AbortError
|
2555
|
+
* });
|
2556
|
+
* // When the request should be aborted
|
2557
|
+
* controller.abort();
|
2558
|
+
* ```
|
2559
|
+
*
|
2560
|
+
* Aborting an ongoing request does not abort individual operating
|
2561
|
+
* system requests but rather the internal buffering `fs.writeFile` performs.
|
2562
|
+
* @since v0.1.29
|
2563
|
+
* @param file filename or file descriptor
|
2564
|
+
*/
|
2565
|
+
export function writeFile(file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void;
|
2566
|
+
/**
|
2567
|
+
* Asynchronously writes data to a file, replacing the file if it already exists.
|
2568
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2569
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2570
|
+
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
2571
|
+
*/
|
2572
|
+
export function writeFile(path: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, callback: NoParamCallback): void;
|
2573
|
+
export namespace writeFile {
|
2574
|
+
/**
|
2575
|
+
* Asynchronously writes data to a file, replacing the file if it already exists.
|
2576
|
+
* @param path A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2577
|
+
* URL support is _experimental_.
|
2578
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2579
|
+
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
2580
|
+
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
2581
|
+
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
2582
|
+
* If `mode` is not supplied, the default of `0o666` is used.
|
2583
|
+
* If `mode` is a string, it is parsed as an octal integer.
|
2584
|
+
* If `flag` is not supplied, the default of `'w'` is used.
|
2585
|
+
*/
|
2586
|
+
function __promisify__(path: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): Promise<void>;
|
2587
|
+
}
|
2588
|
+
/**
|
2589
|
+
* Returns `undefined`.
|
2590
|
+
*
|
2591
|
+
* If `data` is a plain object, it must have an own (not inherited) `toString`function property.
|
2592
|
+
*
|
2593
|
+
* For detailed information, see the documentation of the asynchronous version of
|
2594
|
+
* this API: {@link writeFile}.
|
2595
|
+
* @since v0.1.29
|
2596
|
+
* @param file filename or file descriptor
|
2597
|
+
*/
|
2598
|
+
export function writeFileSync(file: PathOrFileDescriptor, data: string | NodeJS.ArrayBufferView, options?: WriteFileOptions): void;
|
2599
|
+
/**
|
2600
|
+
* Asynchronously append data to a file, creating the file if it does not yet
|
2601
|
+
* exist. `data` can be a string or a `Buffer`.
|
2602
|
+
*
|
2603
|
+
* ```js
|
2604
|
+
* import { appendFile } from 'fs';
|
2605
|
+
*
|
2606
|
+
* appendFile('message.txt', 'data to append', (err) => {
|
2607
|
+
* if (err) throw err;
|
2608
|
+
* console.log('The "data to append" was appended to file!');
|
2609
|
+
* });
|
2610
|
+
* ```
|
2611
|
+
*
|
2612
|
+
* If `options` is a string, then it specifies the encoding:
|
2613
|
+
*
|
2614
|
+
* ```js
|
2615
|
+
* import { appendFile } from 'fs';
|
2616
|
+
*
|
2617
|
+
* appendFile('message.txt', 'data to append', 'utf8', callback);
|
2618
|
+
* ```
|
2619
|
+
*
|
2620
|
+
* The `path` may be specified as a numeric file descriptor that has been opened
|
2621
|
+
* for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will
|
2622
|
+
* not be closed automatically.
|
2623
|
+
*
|
2624
|
+
* ```js
|
2625
|
+
* import { open, close, appendFile } from 'fs';
|
2626
|
+
*
|
2627
|
+
* function closeFd(fd) {
|
2628
|
+
* close(fd, (err) => {
|
2629
|
+
* if (err) throw err;
|
2630
|
+
* });
|
2631
|
+
* }
|
2632
|
+
*
|
2633
|
+
* open('message.txt', 'a', (err, fd) => {
|
2634
|
+
* if (err) throw err;
|
2635
|
+
*
|
2636
|
+
* try {
|
2637
|
+
* appendFile(fd, 'data to append', 'utf8', (err) => {
|
2638
|
+
* closeFd(fd);
|
2639
|
+
* if (err) throw err;
|
2640
|
+
* });
|
2641
|
+
* } catch (err) {
|
2642
|
+
* closeFd(fd);
|
2643
|
+
* throw err;
|
2644
|
+
* }
|
2645
|
+
* });
|
2646
|
+
* ```
|
2647
|
+
* @since v0.6.7
|
2648
|
+
* @param path filename or file descriptor
|
2649
|
+
*/
|
2650
|
+
export function appendFile(path: PathOrFileDescriptor, data: string | Uint8Array, options: WriteFileOptions, callback: NoParamCallback): void;
|
2651
|
+
/**
|
2652
|
+
* Asynchronously append data to a file, creating the file if it does not exist.
|
2653
|
+
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2654
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2655
|
+
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
2656
|
+
*/
|
2657
|
+
export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void;
|
2658
|
+
export namespace appendFile {
|
2659
|
+
/**
|
2660
|
+
* Asynchronously append data to a file, creating the file if it does not exist.
|
2661
|
+
* @param file A path to a file. If a URL is provided, it must use the `file:` protocol.
|
2662
|
+
* URL support is _experimental_.
|
2663
|
+
* If a file descriptor is provided, the underlying file will _not_ be closed automatically.
|
2664
|
+
* @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string.
|
2665
|
+
* @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag.
|
2666
|
+
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
2667
|
+
* If `mode` is not supplied, the default of `0o666` is used.
|
2668
|
+
* If `mode` is a string, it is parsed as an octal integer.
|
2669
|
+
* If `flag` is not supplied, the default of `'a'` is used.
|
2670
|
+
*/
|
2671
|
+
function __promisify__(file: PathOrFileDescriptor, data: string | Uint8Array, options?: WriteFileOptions): Promise<void>;
|
2672
|
+
}
|
2673
|
+
/**
|
2674
|
+
* Synchronously append data to a file, creating the file if it does not yet
|
2675
|
+
* exist. `data` can be a string or a `Buffer`.
|
2676
|
+
*
|
2677
|
+
* ```js
|
2678
|
+
* import { appendFileSync } from 'fs';
|
2679
|
+
*
|
2680
|
+
* try {
|
2681
|
+
* appendFileSync('message.txt', 'data to append');
|
2682
|
+
* console.log('The "data to append" was appended to file!');
|
2683
|
+
* } catch (err) {
|
2684
|
+
* // Handle the error
|
2685
|
+
* }
|
2686
|
+
* ```
|
2687
|
+
*
|
2688
|
+
* If `options` is a string, then it specifies the encoding:
|
2689
|
+
*
|
2690
|
+
* ```js
|
2691
|
+
* import { appendFileSync } from 'fs';
|
2692
|
+
*
|
2693
|
+
* appendFileSync('message.txt', 'data to append', 'utf8');
|
2694
|
+
* ```
|
2695
|
+
*
|
2696
|
+
* The `path` may be specified as a numeric file descriptor that has been opened
|
2697
|
+
* for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will
|
2698
|
+
* not be closed automatically.
|
2699
|
+
*
|
2700
|
+
* ```js
|
2701
|
+
* import { openSync, closeSync, appendFileSync } from 'fs';
|
2702
|
+
*
|
2703
|
+
* let fd;
|
2704
|
+
*
|
2705
|
+
* try {
|
2706
|
+
* fd = openSync('message.txt', 'a');
|
2707
|
+
* appendFileSync(fd, 'data to append', 'utf8');
|
2708
|
+
* } catch (err) {
|
2709
|
+
* // Handle the error
|
2710
|
+
* } finally {
|
2711
|
+
* if (fd !== undefined)
|
2712
|
+
* closeSync(fd);
|
2713
|
+
* }
|
2714
|
+
* ```
|
2715
|
+
* @since v0.6.7
|
2716
|
+
* @param path filename or file descriptor
|
2717
|
+
*/
|
2718
|
+
export function appendFileSync(path: PathOrFileDescriptor, data: string | Uint8Array, options?: WriteFileOptions): void;
|
2719
|
+
/**
|
2720
|
+
* Watch for changes on `filename`. The callback `listener` will be called each
|
2721
|
+
* time the file is accessed.
|
2722
|
+
*
|
2723
|
+
* The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates
|
2724
|
+
* whether the process should continue to run as long as files are being watched.
|
2725
|
+
* The `options` object may specify an `interval` property indicating how often the
|
2726
|
+
* target should be polled in milliseconds.
|
2727
|
+
*
|
2728
|
+
* The `listener` gets two arguments the current stat object and the previous
|
2729
|
+
* stat object:
|
2730
|
+
*
|
2731
|
+
* ```js
|
2732
|
+
* import { watchFile } from 'fs';
|
2733
|
+
*
|
2734
|
+
* watchFile('message.text', (curr, prev) => {
|
2735
|
+
* console.log(`the current mtime is: ${curr.mtime}`);
|
2736
|
+
* console.log(`the previous mtime was: ${prev.mtime}`);
|
2737
|
+
* });
|
2738
|
+
* ```
|
2739
|
+
*
|
2740
|
+
* These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`,
|
2741
|
+
* the numeric values in these objects are specified as `BigInt`s.
|
2742
|
+
*
|
2743
|
+
* To be notified when the file was modified, not just accessed, it is necessary
|
2744
|
+
* to compare `curr.mtime` and `prev.mtime`.
|
2745
|
+
*
|
2746
|
+
* When an `fs.watchFile` operation results in an `ENOENT` error, it
|
2747
|
+
* will invoke the listener once, with all the fields zeroed (or, for dates, the
|
2748
|
+
* Unix Epoch). If the file is created later on, the listener will be called
|
2749
|
+
* again, with the latest stat objects. This is a change in functionality since
|
2750
|
+
* v0.10.
|
2751
|
+
*
|
2752
|
+
* Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible.
|
2753
|
+
*
|
2754
|
+
* When a file being watched by `fs.watchFile()` disappears and reappears,
|
2755
|
+
* then the contents of `previous` in the second callback event (the file's
|
2756
|
+
* reappearance) will be the same as the contents of `previous` in the first
|
2757
|
+
* callback event (its disappearance).
|
2758
|
+
*
|
2759
|
+
* This happens when:
|
2760
|
+
*
|
2761
|
+
* * the file is deleted, followed by a restore
|
2762
|
+
* * the file is renamed and then renamed a second time back to its original name
|
2763
|
+
* @since v0.1.31
|
2764
|
+
*/
|
2765
|
+
export function watchFile(
|
2766
|
+
filename: PathLike,
|
2767
|
+
options:
|
2768
|
+
| {
|
2769
|
+
persistent?: boolean | undefined;
|
2770
|
+
interval?: number | undefined;
|
2771
|
+
}
|
2772
|
+
| undefined,
|
2773
|
+
listener: (curr: Stats, prev: Stats) => void
|
2774
|
+
): void;
|
2775
|
+
/**
|
2776
|
+
* Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed.
|
2777
|
+
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
2778
|
+
*/
|
2779
|
+
export function watchFile(filename: PathLike, listener: (curr: Stats, prev: Stats) => void): void;
|
2780
|
+
/**
|
2781
|
+
* Stop watching for changes on `filename`. If `listener` is specified, only that
|
2782
|
+
* particular listener is removed. Otherwise, _all_ listeners are removed,
|
2783
|
+
* effectively stopping watching of `filename`.
|
2784
|
+
*
|
2785
|
+
* Calling `fs.unwatchFile()` with a filename that is not being watched is a
|
2786
|
+
* no-op, not an error.
|
2787
|
+
*
|
2788
|
+
* Using {@link watch} is more efficient than `fs.watchFile()` and`fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()`and `fs.unwatchFile()` when possible.
|
2789
|
+
* @since v0.1.31
|
2790
|
+
* @param listener Optional, a listener previously attached using `fs.watchFile()`
|
2791
|
+
*/
|
2792
|
+
export function unwatchFile(filename: PathLike, listener?: (curr: Stats, prev: Stats) => void): void;
|
2793
|
+
export interface WatchOptions extends Abortable {
|
2794
|
+
encoding?: BufferEncoding | 'buffer' | undefined;
|
2795
|
+
persistent?: boolean | undefined;
|
2796
|
+
recursive?: boolean | undefined;
|
2797
|
+
}
|
2798
|
+
export type WatchEventType = 'rename' | 'change';
|
2799
|
+
export type WatchListener<T> = (event: WatchEventType, filename: T) => void;
|
2800
|
+
/**
|
2801
|
+
* Watch for changes on `filename`, where `filename` is either a file or a
|
2802
|
+
* directory.
|
2803
|
+
*
|
2804
|
+
* The second argument is optional. If `options` is provided as a string, it
|
2805
|
+
* specifies the `encoding`. Otherwise `options` should be passed as an object.
|
2806
|
+
*
|
2807
|
+
* The listener callback gets two arguments `(eventType, filename)`. `eventType`is either `'rename'` or `'change'`, and `filename` is the name of the file
|
2808
|
+
* which triggered the event.
|
2809
|
+
*
|
2810
|
+
* On most platforms, `'rename'` is emitted whenever a filename appears or
|
2811
|
+
* disappears in the directory.
|
2812
|
+
*
|
2813
|
+
* The listener callback is attached to the `'change'` event fired by `fs.FSWatcher`, but it is not the same thing as the `'change'` value of`eventType`.
|
2814
|
+
*
|
2815
|
+
* If a `signal` is passed, aborting the corresponding AbortController will close
|
2816
|
+
* the returned `fs.FSWatcher`.
|
2817
|
+
* @since v0.5.10
|
2818
|
+
* @param listener
|
2819
|
+
*/
|
2820
|
+
export function watch(
|
2821
|
+
filename: PathLike,
|
2822
|
+
options:
|
2823
|
+
| (WatchOptions & {
|
2824
|
+
encoding: 'buffer';
|
2825
|
+
})
|
2826
|
+
| 'buffer',
|
2827
|
+
listener?: WatchListener<Buffer>
|
2828
|
+
): FSWatcher;
|
2829
|
+
/**
|
2830
|
+
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
2831
|
+
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
2832
|
+
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
2833
|
+
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
2834
|
+
* If `persistent` is not supplied, the default of `true` is used.
|
2835
|
+
* If `recursive` is not supplied, the default of `false` is used.
|
2836
|
+
*/
|
2837
|
+
export function watch(filename: PathLike, options?: WatchOptions | BufferEncoding | null, listener?: WatchListener<string>): FSWatcher;
|
2838
|
+
/**
|
2839
|
+
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
2840
|
+
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
2841
|
+
* @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options.
|
2842
|
+
* If `encoding` is not supplied, the default of `'utf8'` is used.
|
2843
|
+
* If `persistent` is not supplied, the default of `true` is used.
|
2844
|
+
* If `recursive` is not supplied, the default of `false` is used.
|
2845
|
+
*/
|
2846
|
+
export function watch(filename: PathLike, options: WatchOptions | string, listener?: WatchListener<string | Buffer>): FSWatcher;
|
2847
|
+
/**
|
2848
|
+
* Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`.
|
2849
|
+
* @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
2850
|
+
*/
|
2851
|
+
export function watch(filename: PathLike, listener?: WatchListener<string>): FSWatcher;
|
2852
|
+
/**
|
2853
|
+
* Test whether or not the given path exists by checking with the file system.
|
2854
|
+
* Then call the `callback` argument with either true or false:
|
2855
|
+
*
|
2856
|
+
* ```js
|
2857
|
+
* import { exists } from 'fs';
|
2858
|
+
*
|
2859
|
+
* exists('/etc/passwd', (e) => {
|
2860
|
+
* console.log(e ? 'it exists' : 'no passwd!');
|
2861
|
+
* });
|
2862
|
+
* ```
|
2863
|
+
*
|
2864
|
+
* **The parameters for this callback are not consistent with other Node.js**
|
2865
|
+
* **callbacks.** Normally, the first parameter to a Node.js callback is an `err`parameter, optionally followed by other parameters. The `fs.exists()` callback
|
2866
|
+
* has only one boolean parameter. This is one reason `fs.access()` is recommended
|
2867
|
+
* instead of `fs.exists()`.
|
2868
|
+
*
|
2869
|
+
* Using `fs.exists()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()` or `fs.writeFile()` is not recommended. Doing
|
2870
|
+
* so introduces a race condition, since other processes may change the file's
|
2871
|
+
* state between the two calls. Instead, user code should open/read/write the
|
2872
|
+
* file directly and handle the error raised if the file does not exist.
|
2873
|
+
*
|
2874
|
+
* **write (NOT RECOMMENDED)**
|
2875
|
+
*
|
2876
|
+
* ```js
|
2877
|
+
* import { exists, open, close } from 'fs';
|
2878
|
+
*
|
2879
|
+
* exists('myfile', (e) => {
|
2880
|
+
* if (e) {
|
2881
|
+
* console.error('myfile already exists');
|
2882
|
+
* } else {
|
2883
|
+
* open('myfile', 'wx', (err, fd) => {
|
2884
|
+
* if (err) throw err;
|
2885
|
+
*
|
2886
|
+
* try {
|
2887
|
+
* writeMyData(fd);
|
2888
|
+
* } finally {
|
2889
|
+
* close(fd, (err) => {
|
2890
|
+
* if (err) throw err;
|
2891
|
+
* });
|
2892
|
+
* }
|
2893
|
+
* });
|
2894
|
+
* }
|
2895
|
+
* });
|
2896
|
+
* ```
|
2897
|
+
*
|
2898
|
+
* **write (RECOMMENDED)**
|
2899
|
+
*
|
2900
|
+
* ```js
|
2901
|
+
* import { open, close } from 'fs';
|
2902
|
+
* open('myfile', 'wx', (err, fd) => {
|
2903
|
+
* if (err) {
|
2904
|
+
* if (err.code === 'EEXIST') {
|
2905
|
+
* console.error('myfile already exists');
|
2906
|
+
* return;
|
2907
|
+
* }
|
2908
|
+
*
|
2909
|
+
* throw err;
|
2910
|
+
* }
|
2911
|
+
*
|
2912
|
+
* try {
|
2913
|
+
* writeMyData(fd);
|
2914
|
+
* } finally {
|
2915
|
+
* close(fd, (err) => {
|
2916
|
+
* if (err) throw err;
|
2917
|
+
* });
|
2918
|
+
* }
|
2919
|
+
* });
|
2920
|
+
* ```
|
2921
|
+
*
|
2922
|
+
* **read (NOT RECOMMENDED)**
|
2923
|
+
*
|
2924
|
+
* ```js
|
2925
|
+
* import { open, close, exists } from 'fs';
|
2926
|
+
*
|
2927
|
+
* exists('myfile', (e) => {
|
2928
|
+
* if (e) {
|
2929
|
+
* open('myfile', 'r', (err, fd) => {
|
2930
|
+
* if (err) throw err;
|
2931
|
+
*
|
2932
|
+
* try {
|
2933
|
+
* readMyData(fd);
|
2934
|
+
* } finally {
|
2935
|
+
* close(fd, (err) => {
|
2936
|
+
* if (err) throw err;
|
2937
|
+
* });
|
2938
|
+
* }
|
2939
|
+
* });
|
2940
|
+
* } else {
|
2941
|
+
* console.error('myfile does not exist');
|
2942
|
+
* }
|
2943
|
+
* });
|
2944
|
+
* ```
|
2945
|
+
*
|
2946
|
+
* **read (RECOMMENDED)**
|
2947
|
+
*
|
2948
|
+
* ```js
|
2949
|
+
* import { open, close } from 'fs';
|
2950
|
+
*
|
2951
|
+
* open('myfile', 'r', (err, fd) => {
|
2952
|
+
* if (err) {
|
2953
|
+
* if (err.code === 'ENOENT') {
|
2954
|
+
* console.error('myfile does not exist');
|
2955
|
+
* return;
|
2956
|
+
* }
|
2957
|
+
*
|
2958
|
+
* throw err;
|
2959
|
+
* }
|
2960
|
+
*
|
2961
|
+
* try {
|
2962
|
+
* readMyData(fd);
|
2963
|
+
* } finally {
|
2964
|
+
* close(fd, (err) => {
|
2965
|
+
* if (err) throw err;
|
2966
|
+
* });
|
2967
|
+
* }
|
2968
|
+
* });
|
2969
|
+
* ```
|
2970
|
+
*
|
2971
|
+
* The "not recommended" examples above check for existence and then use the
|
2972
|
+
* file; the "recommended" examples are better because they use the file directly
|
2973
|
+
* and handle the error, if any.
|
2974
|
+
*
|
2975
|
+
* In general, check for the existence of a file only if the file won’t be
|
2976
|
+
* used directly, for example when its existence is a signal from another
|
2977
|
+
* process.
|
2978
|
+
* @since v0.0.2
|
2979
|
+
* @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead.
|
2980
|
+
*/
|
2981
|
+
export function exists(path: PathLike, callback: (exists: boolean) => void): void;
|
2982
|
+
export namespace exists {
|
2983
|
+
/**
|
2984
|
+
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
2985
|
+
* URL support is _experimental_.
|
2986
|
+
*/
|
2987
|
+
function __promisify__(path: PathLike): Promise<boolean>;
|
2988
|
+
}
|
2989
|
+
/**
|
2990
|
+
* Returns `true` if the path exists, `false` otherwise.
|
2991
|
+
*
|
2992
|
+
* For detailed information, see the documentation of the asynchronous version of
|
2993
|
+
* this API: {@link exists}.
|
2994
|
+
*
|
2995
|
+
* `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback`parameter to `fs.exists()` accepts parameters that are inconsistent with other
|
2996
|
+
* Node.js callbacks. `fs.existsSync()` does not use a callback.
|
2997
|
+
*
|
2998
|
+
* ```js
|
2999
|
+
* import { existsSync } from 'fs';
|
3000
|
+
*
|
3001
|
+
* if (existsSync('/etc/passwd'))
|
3002
|
+
* console.log('The path exists.');
|
3003
|
+
* ```
|
3004
|
+
* @since v0.1.21
|
3005
|
+
*/
|
3006
|
+
export function existsSync(path: PathLike): boolean;
|
3007
|
+
export namespace constants {
|
3008
|
+
// File Access Constants
|
3009
|
+
/** Constant for fs.access(). File is visible to the calling process. */
|
3010
|
+
const F_OK: number;
|
3011
|
+
/** Constant for fs.access(). File can be read by the calling process. */
|
3012
|
+
const R_OK: number;
|
3013
|
+
/** Constant for fs.access(). File can be written by the calling process. */
|
3014
|
+
const W_OK: number;
|
3015
|
+
/** Constant for fs.access(). File can be executed by the calling process. */
|
3016
|
+
const X_OK: number;
|
3017
|
+
// File Copy Constants
|
3018
|
+
/** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */
|
3019
|
+
const COPYFILE_EXCL: number;
|
3020
|
+
/**
|
3021
|
+
* Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink.
|
3022
|
+
* If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used.
|
3023
|
+
*/
|
3024
|
+
const COPYFILE_FICLONE: number;
|
3025
|
+
/**
|
3026
|
+
* Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink.
|
3027
|
+
* If the underlying platform does not support copy-on-write, then the operation will fail with an error.
|
3028
|
+
*/
|
3029
|
+
const COPYFILE_FICLONE_FORCE: number;
|
3030
|
+
// File Open Constants
|
3031
|
+
/** Constant for fs.open(). Flag indicating to open a file for read-only access. */
|
3032
|
+
const O_RDONLY: number;
|
3033
|
+
/** Constant for fs.open(). Flag indicating to open a file for write-only access. */
|
3034
|
+
const O_WRONLY: number;
|
3035
|
+
/** Constant for fs.open(). Flag indicating to open a file for read-write access. */
|
3036
|
+
const O_RDWR: number;
|
3037
|
+
/** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */
|
3038
|
+
const O_CREAT: number;
|
3039
|
+
/** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */
|
3040
|
+
const O_EXCL: number;
|
3041
|
+
/**
|
3042
|
+
* Constant for fs.open(). Flag indicating that if path identifies a terminal device,
|
3043
|
+
* opening the path shall not cause that terminal to become the controlling terminal for the process
|
3044
|
+
* (if the process does not already have one).
|
3045
|
+
*/
|
3046
|
+
const O_NOCTTY: number;
|
3047
|
+
/** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */
|
3048
|
+
const O_TRUNC: number;
|
3049
|
+
/** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */
|
3050
|
+
const O_APPEND: number;
|
3051
|
+
/** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */
|
3052
|
+
const O_DIRECTORY: number;
|
3053
|
+
/**
|
3054
|
+
* constant for fs.open().
|
3055
|
+
* Flag indicating reading accesses to the file system will no longer result in
|
3056
|
+
* an update to the atime information associated with the file.
|
3057
|
+
* This flag is available on Linux operating systems only.
|
3058
|
+
*/
|
3059
|
+
const O_NOATIME: number;
|
3060
|
+
/** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */
|
3061
|
+
const O_NOFOLLOW: number;
|
3062
|
+
/** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */
|
3063
|
+
const O_SYNC: number;
|
3064
|
+
/** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */
|
3065
|
+
const O_DSYNC: number;
|
3066
|
+
/** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */
|
3067
|
+
const O_SYMLINK: number;
|
3068
|
+
/** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */
|
3069
|
+
const O_DIRECT: number;
|
3070
|
+
/** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */
|
3071
|
+
const O_NONBLOCK: number;
|
3072
|
+
// File Type Constants
|
3073
|
+
/** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */
|
3074
|
+
const S_IFMT: number;
|
3075
|
+
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */
|
3076
|
+
const S_IFREG: number;
|
3077
|
+
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */
|
3078
|
+
const S_IFDIR: number;
|
3079
|
+
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */
|
3080
|
+
const S_IFCHR: number;
|
3081
|
+
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */
|
3082
|
+
const S_IFBLK: number;
|
3083
|
+
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */
|
3084
|
+
const S_IFIFO: number;
|
3085
|
+
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */
|
3086
|
+
const S_IFLNK: number;
|
3087
|
+
/** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */
|
3088
|
+
const S_IFSOCK: number;
|
3089
|
+
// File Mode Constants
|
3090
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */
|
3091
|
+
const S_IRWXU: number;
|
3092
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */
|
3093
|
+
const S_IRUSR: number;
|
3094
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */
|
3095
|
+
const S_IWUSR: number;
|
3096
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */
|
3097
|
+
const S_IXUSR: number;
|
3098
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */
|
3099
|
+
const S_IRWXG: number;
|
3100
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */
|
3101
|
+
const S_IRGRP: number;
|
3102
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */
|
3103
|
+
const S_IWGRP: number;
|
3104
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */
|
3105
|
+
const S_IXGRP: number;
|
3106
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */
|
3107
|
+
const S_IRWXO: number;
|
3108
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */
|
3109
|
+
const S_IROTH: number;
|
3110
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */
|
3111
|
+
const S_IWOTH: number;
|
3112
|
+
/** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */
|
3113
|
+
const S_IXOTH: number;
|
3114
|
+
/**
|
3115
|
+
* When set, a memory file mapping is used to access the file. This flag
|
3116
|
+
* is available on Windows operating systems only. On other operating systems,
|
3117
|
+
* this flag is ignored.
|
3118
|
+
*/
|
3119
|
+
const UV_FS_O_FILEMAP: number;
|
3120
|
+
}
|
3121
|
+
/**
|
3122
|
+
* Tests a user's permissions for the file or directory specified by `path`.
|
3123
|
+
* The `mode` argument is an optional integer that specifies the accessibility
|
3124
|
+
* checks to be performed. Check `File access constants` for possible values
|
3125
|
+
* of `mode`. It is possible to create a mask consisting of the bitwise OR of
|
3126
|
+
* two or more values (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
|
3127
|
+
*
|
3128
|
+
* The final argument, `callback`, is a callback function that is invoked with
|
3129
|
+
* a possible error argument. If any of the accessibility checks fail, the error
|
3130
|
+
* argument will be an `Error` object. The following examples check if`package.json` exists, and if it is readable or writable.
|
3131
|
+
*
|
3132
|
+
* ```js
|
3133
|
+
* import { access, constants } from 'fs';
|
3134
|
+
*
|
3135
|
+
* const file = 'package.json';
|
3136
|
+
*
|
3137
|
+
* // Check if the file exists in the current directory.
|
3138
|
+
* access(file, constants.F_OK, (err) => {
|
3139
|
+
* console.log(`${file} ${err ? 'does not exist' : 'exists'}`);
|
3140
|
+
* });
|
3141
|
+
*
|
3142
|
+
* // Check if the file is readable.
|
3143
|
+
* access(file, constants.R_OK, (err) => {
|
3144
|
+
* console.log(`${file} ${err ? 'is not readable' : 'is readable'}`);
|
3145
|
+
* });
|
3146
|
+
*
|
3147
|
+
* // Check if the file is writable.
|
3148
|
+
* access(file, constants.W_OK, (err) => {
|
3149
|
+
* console.log(`${file} ${err ? 'is not writable' : 'is writable'}`);
|
3150
|
+
* });
|
3151
|
+
*
|
3152
|
+
* // Check if the file exists in the current directory, and if it is writable.
|
3153
|
+
* access(file, constants.F_OK | constants.W_OK, (err) => {
|
3154
|
+
* if (err) {
|
3155
|
+
* console.error(
|
3156
|
+
* `${file} ${err.code === 'ENOENT' ? 'does not exist' : 'is read-only'}`);
|
3157
|
+
* } else {
|
3158
|
+
* console.log(`${file} exists, and it is writable`);
|
3159
|
+
* }
|
3160
|
+
* });
|
3161
|
+
* ```
|
3162
|
+
*
|
3163
|
+
* Do not use `fs.access()` to check for the accessibility of a file before calling`fs.open()`, `fs.readFile()` or `fs.writeFile()`. Doing
|
3164
|
+
* so introduces a race condition, since other processes may change the file's
|
3165
|
+
* state between the two calls. Instead, user code should open/read/write the
|
3166
|
+
* file directly and handle the error raised if the file is not accessible.
|
3167
|
+
*
|
3168
|
+
* **write (NOT RECOMMENDED)**
|
3169
|
+
*
|
3170
|
+
* ```js
|
3171
|
+
* import { access, open, close } from 'fs';
|
3172
|
+
*
|
3173
|
+
* access('myfile', (err) => {
|
3174
|
+
* if (!err) {
|
3175
|
+
* console.error('myfile already exists');
|
3176
|
+
* return;
|
3177
|
+
* }
|
3178
|
+
*
|
3179
|
+
* open('myfile', 'wx', (err, fd) => {
|
3180
|
+
* if (err) throw err;
|
3181
|
+
*
|
3182
|
+
* try {
|
3183
|
+
* writeMyData(fd);
|
3184
|
+
* } finally {
|
3185
|
+
* close(fd, (err) => {
|
3186
|
+
* if (err) throw err;
|
3187
|
+
* });
|
3188
|
+
* }
|
3189
|
+
* });
|
3190
|
+
* });
|
3191
|
+
* ```
|
3192
|
+
*
|
3193
|
+
* **write (RECOMMENDED)**
|
3194
|
+
*
|
3195
|
+
* ```js
|
3196
|
+
* import { open, close } from 'fs';
|
3197
|
+
*
|
3198
|
+
* open('myfile', 'wx', (err, fd) => {
|
3199
|
+
* if (err) {
|
3200
|
+
* if (err.code === 'EEXIST') {
|
3201
|
+
* console.error('myfile already exists');
|
3202
|
+
* return;
|
3203
|
+
* }
|
3204
|
+
*
|
3205
|
+
* throw err;
|
3206
|
+
* }
|
3207
|
+
*
|
3208
|
+
* try {
|
3209
|
+
* writeMyData(fd);
|
3210
|
+
* } finally {
|
3211
|
+
* close(fd, (err) => {
|
3212
|
+
* if (err) throw err;
|
3213
|
+
* });
|
3214
|
+
* }
|
3215
|
+
* });
|
3216
|
+
* ```
|
3217
|
+
*
|
3218
|
+
* **read (NOT RECOMMENDED)**
|
3219
|
+
*
|
3220
|
+
* ```js
|
3221
|
+
* import { access, open, close } from 'fs';
|
3222
|
+
* access('myfile', (err) => {
|
3223
|
+
* if (err) {
|
3224
|
+
* if (err.code === 'ENOENT') {
|
3225
|
+
* console.error('myfile does not exist');
|
3226
|
+
* return;
|
3227
|
+
* }
|
3228
|
+
*
|
3229
|
+
* throw err;
|
3230
|
+
* }
|
3231
|
+
*
|
3232
|
+
* open('myfile', 'r', (err, fd) => {
|
3233
|
+
* if (err) throw err;
|
3234
|
+
*
|
3235
|
+
* try {
|
3236
|
+
* readMyData(fd);
|
3237
|
+
* } finally {
|
3238
|
+
* close(fd, (err) => {
|
3239
|
+
* if (err) throw err;
|
3240
|
+
* });
|
3241
|
+
* }
|
3242
|
+
* });
|
3243
|
+
* });
|
3244
|
+
* ```
|
3245
|
+
*
|
3246
|
+
* **read (RECOMMENDED)**
|
3247
|
+
*
|
3248
|
+
* ```js
|
3249
|
+
* import { open, close } from 'fs';
|
3250
|
+
*
|
3251
|
+
* open('myfile', 'r', (err, fd) => {
|
3252
|
+
* if (err) {
|
3253
|
+
* if (err.code === 'ENOENT') {
|
3254
|
+
* console.error('myfile does not exist');
|
3255
|
+
* return;
|
3256
|
+
* }
|
3257
|
+
*
|
3258
|
+
* throw err;
|
3259
|
+
* }
|
3260
|
+
*
|
3261
|
+
* try {
|
3262
|
+
* readMyData(fd);
|
3263
|
+
* } finally {
|
3264
|
+
* close(fd, (err) => {
|
3265
|
+
* if (err) throw err;
|
3266
|
+
* });
|
3267
|
+
* }
|
3268
|
+
* });
|
3269
|
+
* ```
|
3270
|
+
*
|
3271
|
+
* The "not recommended" examples above check for accessibility and then use the
|
3272
|
+
* file; the "recommended" examples are better because they use the file directly
|
3273
|
+
* and handle the error, if any.
|
3274
|
+
*
|
3275
|
+
* In general, check for the accessibility of a file only if the file will not be
|
3276
|
+
* used directly, for example when its accessibility is a signal from another
|
3277
|
+
* process.
|
3278
|
+
*
|
3279
|
+
* On Windows, access-control policies (ACLs) on a directory may limit access to
|
3280
|
+
* a file or directory. The `fs.access()` function, however, does not check the
|
3281
|
+
* ACL and therefore may report that a path is accessible even if the ACL restricts
|
3282
|
+
* the user from reading or writing to it.
|
3283
|
+
* @since v0.11.15
|
3284
|
+
* @param [mode=fs.constants.F_OK]
|
3285
|
+
*/
|
3286
|
+
export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void;
|
3287
|
+
/**
|
3288
|
+
* Asynchronously tests a user's permissions for the file specified by path.
|
3289
|
+
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
3290
|
+
*/
|
3291
|
+
export function access(path: PathLike, callback: NoParamCallback): void;
|
3292
|
+
export namespace access {
|
3293
|
+
/**
|
3294
|
+
* Asynchronously tests a user's permissions for the file specified by path.
|
3295
|
+
* @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol.
|
3296
|
+
* URL support is _experimental_.
|
3297
|
+
*/
|
3298
|
+
function __promisify__(path: PathLike, mode?: number): Promise<void>;
|
3299
|
+
}
|
3300
|
+
/**
|
3301
|
+
* Synchronously tests a user's permissions for the file or directory specified
|
3302
|
+
* by `path`. The `mode` argument is an optional integer that specifies the
|
3303
|
+
* accessibility checks to be performed. Check `File access constants` for
|
3304
|
+
* possible values of `mode`. It is possible to create a mask consisting of
|
3305
|
+
* the bitwise OR of two or more values
|
3306
|
+
* (e.g. `fs.constants.W_OK | fs.constants.R_OK`).
|
3307
|
+
*
|
3308
|
+
* If any of the accessibility checks fail, an `Error` will be thrown. Otherwise,
|
3309
|
+
* the method will return `undefined`.
|
3310
|
+
*
|
3311
|
+
* ```js
|
3312
|
+
* import { accessSync, constants } from 'fs';
|
3313
|
+
*
|
3314
|
+
* try {
|
3315
|
+
* accessSync('etc/passwd', constants.R_OK | constants.W_OK);
|
3316
|
+
* console.log('can read/write');
|
3317
|
+
* } catch (err) {
|
3318
|
+
* console.error('no access!');
|
3319
|
+
* }
|
3320
|
+
* ```
|
3321
|
+
* @since v0.11.15
|
3322
|
+
* @param [mode=fs.constants.F_OK]
|
3323
|
+
*/
|
3324
|
+
export function accessSync(path: PathLike, mode?: number): void;
|
3325
|
+
interface StreamOptions {
|
3326
|
+
flags?: string | undefined;
|
3327
|
+
encoding?: BufferEncoding | undefined;
|
3328
|
+
fd?: number | promises.FileHandle | undefined;
|
3329
|
+
mode?: number | undefined;
|
3330
|
+
autoClose?: boolean | undefined;
|
3331
|
+
/**
|
3332
|
+
* @default false
|
3333
|
+
*/
|
3334
|
+
emitClose?: boolean | undefined;
|
3335
|
+
start?: number | undefined;
|
3336
|
+
highWaterMark?: number | undefined;
|
3337
|
+
}
|
3338
|
+
interface ReadStreamOptions extends StreamOptions {
|
3339
|
+
end?: number | undefined;
|
3340
|
+
}
|
3341
|
+
/**
|
3342
|
+
* Unlike the 16 kb default `highWaterMark` for a readable stream, the stream
|
3343
|
+
* returned by this method has a default `highWaterMark` of 64 kb.
|
3344
|
+
*
|
3345
|
+
* `options` can include `start` and `end` values to read a range of bytes from
|
3346
|
+
* the file instead of the entire file. Both `start` and `end` are inclusive and
|
3347
|
+
* start counting at 0, allowed values are in the
|
3348
|
+
* \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `fd` is specified and `start` is
|
3349
|
+
* omitted or `undefined`, `fs.createReadStream()` reads sequentially from the
|
3350
|
+
* current file position. The `encoding` can be any one of those accepted by `Buffer`.
|
3351
|
+
*
|
3352
|
+
* If `fd` is specified, `ReadStream` will ignore the `path` argument and will use
|
3353
|
+
* the specified file descriptor. This means that no `'open'` event will be
|
3354
|
+
* emitted. `fd` should be blocking; non-blocking `fd`s should be passed to `net.Socket`.
|
3355
|
+
*
|
3356
|
+
* If `fd` points to a character device that only supports blocking reads
|
3357
|
+
* (such as keyboard or sound card), read operations do not finish until data is
|
3358
|
+
* available. This can prevent the process from exiting and the stream from
|
3359
|
+
* closing naturally.
|
3360
|
+
*
|
3361
|
+
* By default, the stream will emit a `'close'` event after it has been
|
3362
|
+
* destroyed, like most `Readable` streams. Set the `emitClose` option to`false` to change this behavior.
|
3363
|
+
*
|
3364
|
+
* By providing the `fs` option, it is possible to override the corresponding `fs`implementations for `open`, `read`, and `close`. When providing the `fs` option,
|
3365
|
+
* overrides for `open`, `read`, and `close` are required.
|
3366
|
+
*
|
3367
|
+
* ```js
|
3368
|
+
* import { createReadStream } from 'fs';
|
3369
|
+
*
|
3370
|
+
* // Create a stream from some character device.
|
3371
|
+
* const stream = createReadStream('/dev/input/event0');
|
3372
|
+
* setTimeout(() => {
|
3373
|
+
* stream.close(); // This may not close the stream.
|
3374
|
+
* // Artificially marking end-of-stream, as if the underlying resource had
|
3375
|
+
* // indicated end-of-file by itself, allows the stream to close.
|
3376
|
+
* // This does not cancel pending read operations, and if there is such an
|
3377
|
+
* // operation, the process may still not be able to exit successfully
|
3378
|
+
* // until it finishes.
|
3379
|
+
* stream.push(null);
|
3380
|
+
* stream.read(0);
|
3381
|
+
* }, 100);
|
3382
|
+
* ```
|
3383
|
+
*
|
3384
|
+
* If `autoClose` is false, then the file descriptor won't be closed, even if
|
3385
|
+
* there's an error. It is the application's responsibility to close it and make
|
3386
|
+
* sure there's no file descriptor leak. If `autoClose` is set to true (default
|
3387
|
+
* behavior), on `'error'` or `'end'` the file descriptor will be closed
|
3388
|
+
* automatically.
|
3389
|
+
*
|
3390
|
+
* `mode` sets the file mode (permission and sticky bits), but only if the
|
3391
|
+
* file was created.
|
3392
|
+
*
|
3393
|
+
* An example to read the last 10 bytes of a file which is 100 bytes long:
|
3394
|
+
*
|
3395
|
+
* ```js
|
3396
|
+
* import { createReadStream } from 'fs';
|
3397
|
+
*
|
3398
|
+
* createReadStream('sample.txt', { start: 90, end: 99 });
|
3399
|
+
* ```
|
3400
|
+
*
|
3401
|
+
* If `options` is a string, then it specifies the encoding.
|
3402
|
+
* @since v0.1.31
|
3403
|
+
* @return See `Readable Stream`.
|
3404
|
+
*/
|
3405
|
+
export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream;
|
3406
|
+
/**
|
3407
|
+
* `options` may also include a `start` option to allow writing data at some
|
3408
|
+
* position past the beginning of the file, allowed values are in the
|
3409
|
+
* \[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
|
3410
|
+
* it may require the `flags` option to be set to `r+` rather than the default `w`.
|
3411
|
+
* The `encoding` can be any one of those accepted by `Buffer`.
|
3412
|
+
*
|
3413
|
+
* If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false,
|
3414
|
+
* then the file descriptor won't be closed, even if there's an error.
|
3415
|
+
* It is the application's responsibility to close it and make sure there's no
|
3416
|
+
* file descriptor leak.
|
3417
|
+
*
|
3418
|
+
* By default, the stream will emit a `'close'` event after it has been
|
3419
|
+
* destroyed, like most `Writable` streams. Set the `emitClose` option to`false` to change this behavior.
|
3420
|
+
*
|
3421
|
+
* By providing the `fs` option it is possible to override the corresponding `fs`implementations for `open`, `write`, `writev` and `close`. Overriding `write()`without `writev()` can reduce
|
3422
|
+
* performance as some optimizations (`_writev()`)
|
3423
|
+
* will be disabled. When providing the `fs` option, overrides for `open`,`close`, and at least one of `write` and `writev` are required.
|
3424
|
+
*
|
3425
|
+
* Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the`path` argument and will use the specified file descriptor. This means that no`'open'` event will be
|
3426
|
+
* emitted. `fd` should be blocking; non-blocking `fd`s
|
3427
|
+
* should be passed to `net.Socket`.
|
3428
|
+
*
|
3429
|
+
* If `options` is a string, then it specifies the encoding.
|
3430
|
+
* @since v0.1.31
|
3431
|
+
* @return See `Writable Stream`.
|
3432
|
+
*/
|
3433
|
+
export function createWriteStream(path: PathLike, options?: BufferEncoding | StreamOptions): WriteStream;
|
3434
|
+
/**
|
3435
|
+
* Forces all currently queued I/O operations associated with the file to the
|
3436
|
+
* 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. No arguments other
|
3437
|
+
* than a possible
|
3438
|
+
* exception are given to the completion callback.
|
3439
|
+
* @since v0.1.96
|
3440
|
+
*/
|
3441
|
+
export function fdatasync(fd: number, callback: NoParamCallback): void;
|
3442
|
+
export namespace fdatasync {
|
3443
|
+
/**
|
3444
|
+
* Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device.
|
3445
|
+
* @param fd A file descriptor.
|
3446
|
+
*/
|
3447
|
+
function __promisify__(fd: number): Promise<void>;
|
3448
|
+
}
|
3449
|
+
/**
|
3450
|
+
* Forces all currently queued I/O operations associated with the file to the
|
3451
|
+
* 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. Returns `undefined`.
|
3452
|
+
* @since v0.1.96
|
3453
|
+
*/
|
3454
|
+
export function fdatasyncSync(fd: number): void;
|
3455
|
+
/**
|
3456
|
+
* Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it
|
3457
|
+
* already exists. No arguments other than a possible exception are given to the
|
3458
|
+
* callback function. Node.js makes no guarantees about the atomicity of the copy
|
3459
|
+
* operation. If an error occurs after the destination file has been opened for
|
3460
|
+
* writing, Node.js will attempt to remove the destination.
|
3461
|
+
*
|
3462
|
+
* `mode` is an optional integer that specifies the behavior
|
3463
|
+
* of the copy operation. It is possible to create a mask consisting of the bitwise
|
3464
|
+
* OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`).
|
3465
|
+
*
|
3466
|
+
* * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already
|
3467
|
+
* exists.
|
3468
|
+
* * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a
|
3469
|
+
* copy-on-write reflink. If the platform does not support copy-on-write, then a
|
3470
|
+
* fallback copy mechanism is used.
|
3471
|
+
* * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to
|
3472
|
+
* create a copy-on-write reflink. If the platform does not support
|
3473
|
+
* copy-on-write, then the operation will fail.
|
3474
|
+
*
|
3475
|
+
* ```js
|
3476
|
+
* import { copyFile, constants } from 'fs';
|
3477
|
+
*
|
3478
|
+
* function callback(err) {
|
3479
|
+
* if (err) throw err;
|
3480
|
+
* console.log('source.txt was copied to destination.txt');
|
3481
|
+
* }
|
3482
|
+
*
|
3483
|
+
* // destination.txt will be created or overwritten by default.
|
3484
|
+
* copyFile('source.txt', 'destination.txt', callback);
|
3485
|
+
*
|
3486
|
+
* // By using COPYFILE_EXCL, the operation will fail if destination.txt exists.
|
3487
|
+
* copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL, callback);
|
3488
|
+
* ```
|
3489
|
+
* @since v8.5.0
|
3490
|
+
* @param src source filename to copy
|
3491
|
+
* @param dest destination filename of the copy operation
|
3492
|
+
* @param [mode=0] modifiers for copy operation.
|
3493
|
+
*/
|
3494
|
+
export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void;
|
3495
|
+
export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void;
|
3496
|
+
export namespace copyFile {
|
3497
|
+
function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise<void>;
|
3498
|
+
}
|
3499
|
+
/**
|
3500
|
+
* Synchronously copies `src` to `dest`. By default, `dest` is overwritten if it
|
3501
|
+
* already exists. Returns `undefined`. Node.js makes no guarantees about the
|
3502
|
+
* atomicity of the copy operation. If an error occurs after the destination file
|
3503
|
+
* has been opened for writing, Node.js will attempt to remove the destination.
|
3504
|
+
*
|
3505
|
+
* `mode` is an optional integer that specifies the behavior
|
3506
|
+
* of the copy operation. It is possible to create a mask consisting of the bitwise
|
3507
|
+
* OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`).
|
3508
|
+
*
|
3509
|
+
* * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already
|
3510
|
+
* exists.
|
3511
|
+
* * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a
|
3512
|
+
* copy-on-write reflink. If the platform does not support copy-on-write, then a
|
3513
|
+
* fallback copy mechanism is used.
|
3514
|
+
* * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to
|
3515
|
+
* create a copy-on-write reflink. If the platform does not support
|
3516
|
+
* copy-on-write, then the operation will fail.
|
3517
|
+
*
|
3518
|
+
* ```js
|
3519
|
+
* import { copyFileSync, constants } from 'fs';
|
3520
|
+
*
|
3521
|
+
* // destination.txt will be created or overwritten by default.
|
3522
|
+
* copyFileSync('source.txt', 'destination.txt');
|
3523
|
+
* console.log('source.txt was copied to destination.txt');
|
3524
|
+
*
|
3525
|
+
* // By using COPYFILE_EXCL, the operation will fail if destination.txt exists.
|
3526
|
+
* copyFileSync('source.txt', 'destination.txt', constants.COPYFILE_EXCL);
|
3527
|
+
* ```
|
3528
|
+
* @since v8.5.0
|
3529
|
+
* @param src source filename to copy
|
3530
|
+
* @param dest destination filename of the copy operation
|
3531
|
+
* @param [mode=0] modifiers for copy operation.
|
3532
|
+
*/
|
3533
|
+
export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void;
|
3534
|
+
/**
|
3535
|
+
* Write an array of `ArrayBufferView`s to the file specified by `fd` using`writev()`.
|
3536
|
+
*
|
3537
|
+
* `position` is the offset from the beginning of the file where this data
|
3538
|
+
* should be written. If `typeof position !== 'number'`, the data will be written
|
3539
|
+
* at the current position.
|
3540
|
+
*
|
3541
|
+
* The callback will be given three arguments: `err`, `bytesWritten`, and`buffers`. `bytesWritten` is how many bytes were written from `buffers`.
|
3542
|
+
*
|
3543
|
+
* If this method is `util.promisify()` ed, it returns a promise for an`Object` with `bytesWritten` and `buffers` properties.
|
3544
|
+
*
|
3545
|
+
* It is unsafe to use `fs.writev()` multiple times on the same file without
|
3546
|
+
* waiting for the callback. For this scenario, use {@link createWriteStream}.
|
3547
|
+
*
|
3548
|
+
* On Linux, positional writes don't work when the file is opened in append mode.
|
3549
|
+
* The kernel ignores the position argument and always appends the data to
|
3550
|
+
* the end of the file.
|
3551
|
+
* @since v12.9.0
|
3552
|
+
*/
|
3553
|
+
export function writev(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void): void;
|
3554
|
+
export function writev(
|
3555
|
+
fd: number,
|
3556
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
3557
|
+
position: number,
|
3558
|
+
cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void
|
3559
|
+
): void;
|
3560
|
+
export interface WriteVResult {
|
3561
|
+
bytesWritten: number;
|
3562
|
+
buffers: NodeJS.ArrayBufferView[];
|
3563
|
+
}
|
3564
|
+
export namespace writev {
|
3565
|
+
function __promisify__(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<WriteVResult>;
|
3566
|
+
}
|
3567
|
+
/**
|
3568
|
+
* For detailed information, see the documentation of the asynchronous version of
|
3569
|
+
* this API: {@link writev}.
|
3570
|
+
* @since v12.9.0
|
3571
|
+
* @return The number of bytes written.
|
3572
|
+
*/
|
3573
|
+
export function writevSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
|
3574
|
+
/**
|
3575
|
+
* Read from a file specified by `fd` and write to an array of `ArrayBufferView`s
|
3576
|
+
* using `readv()`.
|
3577
|
+
*
|
3578
|
+
* `position` is the offset from the beginning of the file from where data
|
3579
|
+
* should be read. If `typeof position !== 'number'`, the data will be read
|
3580
|
+
* from the current position.
|
3581
|
+
*
|
3582
|
+
* The callback will be given three arguments: `err`, `bytesRead`, and`buffers`. `bytesRead` is how many bytes were read from the file.
|
3583
|
+
*
|
3584
|
+
* If this method is invoked as its `util.promisify()` ed version, it returns
|
3585
|
+
* a promise for an `Object` with `bytesRead` and `buffers` properties.
|
3586
|
+
* @since v13.13.0, v12.17.0
|
3587
|
+
*/
|
3588
|
+
export function readv(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void): void;
|
3589
|
+
export function readv(
|
3590
|
+
fd: number,
|
3591
|
+
buffers: ReadonlyArray<NodeJS.ArrayBufferView>,
|
3592
|
+
position: number,
|
3593
|
+
cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void
|
3594
|
+
): void;
|
3595
|
+
export interface ReadVResult {
|
3596
|
+
bytesRead: number;
|
3597
|
+
buffers: NodeJS.ArrayBufferView[];
|
3598
|
+
}
|
3599
|
+
export namespace readv {
|
3600
|
+
function __promisify__(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): Promise<ReadVResult>;
|
3601
|
+
}
|
3602
|
+
/**
|
3603
|
+
* For detailed information, see the documentation of the asynchronous version of
|
3604
|
+
* this API: {@link readv}.
|
3605
|
+
* @since v13.13.0, v12.17.0
|
3606
|
+
* @return The number of bytes read.
|
3607
|
+
*/
|
3608
|
+
export function readvSync(fd: number, buffers: ReadonlyArray<NodeJS.ArrayBufferView>, position?: number): number;
|
3609
|
+
export interface OpenDirOptions {
|
3610
|
+
encoding?: BufferEncoding | undefined;
|
3611
|
+
/**
|
3612
|
+
* Number of directory entries that are buffered
|
3613
|
+
* internally when reading from the directory. Higher values lead to better
|
3614
|
+
* performance but higher memory usage.
|
3615
|
+
* @default 32
|
3616
|
+
*/
|
3617
|
+
bufferSize?: number | undefined;
|
3618
|
+
}
|
3619
|
+
/**
|
3620
|
+
* Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html).
|
3621
|
+
*
|
3622
|
+
* Creates an `fs.Dir`, which contains all further functions for reading from
|
3623
|
+
* and cleaning up the directory.
|
3624
|
+
*
|
3625
|
+
* The `encoding` option sets the encoding for the `path` while opening the
|
3626
|
+
* directory and subsequent read operations.
|
3627
|
+
* @since v12.12.0
|
3628
|
+
*/
|
3629
|
+
export function opendirSync(path: string, options?: OpenDirOptions): Dir;
|
3630
|
+
/**
|
3631
|
+
* Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for
|
3632
|
+
* more details.
|
3633
|
+
*
|
3634
|
+
* Creates an `fs.Dir`, which contains all further functions for reading from
|
3635
|
+
* and cleaning up the directory.
|
3636
|
+
*
|
3637
|
+
* The `encoding` option sets the encoding for the `path` while opening the
|
3638
|
+
* directory and subsequent read operations.
|
3639
|
+
* @since v12.12.0
|
3640
|
+
*/
|
3641
|
+
export function opendir(path: string, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
3642
|
+
export function opendir(path: string, options: OpenDirOptions, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void;
|
3643
|
+
export namespace opendir {
|
3644
|
+
function __promisify__(path: string, options?: OpenDirOptions): Promise<Dir>;
|
3645
|
+
}
|
3646
|
+
export interface BigIntStats extends StatsBase<bigint> {
|
3647
|
+
atimeNs: bigint;
|
3648
|
+
mtimeNs: bigint;
|
3649
|
+
ctimeNs: bigint;
|
3650
|
+
birthtimeNs: bigint;
|
3651
|
+
}
|
3652
|
+
export interface BigIntOptions {
|
3653
|
+
bigint: true;
|
3654
|
+
}
|
3655
|
+
export interface StatOptions {
|
3656
|
+
bigint?: boolean | undefined;
|
3657
|
+
throwIfNoEntry?: boolean | undefined;
|
3658
|
+
}
|
3659
|
+
export interface CopyOptions {
|
3660
|
+
/**
|
3661
|
+
* Dereference symlinks
|
3662
|
+
* @default false
|
3663
|
+
*/
|
3664
|
+
dereference?: boolean;
|
3665
|
+
/**
|
3666
|
+
* When `force` is `false`, and the destination
|
3667
|
+
* exists, throw an error.
|
3668
|
+
* @default false
|
3669
|
+
*/
|
3670
|
+
errorOnExist?: boolean;
|
3671
|
+
/**
|
3672
|
+
* Function to filter copied files/directories. Return
|
3673
|
+
* `true` to copy the item, `false` to ignore it.
|
3674
|
+
*/
|
3675
|
+
filter?(source: string, destination: string): boolean;
|
3676
|
+
/**
|
3677
|
+
* Overwrite existing file or directory. _The copy
|
3678
|
+
* operation will ignore errors if you set this to false and the destination
|
3679
|
+
* exists. Use the `errorOnExist` option to change this behavior.
|
3680
|
+
* @default true
|
3681
|
+
*/
|
3682
|
+
force?: boolean;
|
3683
|
+
/**
|
3684
|
+
* When `true` timestamps from `src` will
|
3685
|
+
* be preserved.
|
3686
|
+
* @default false
|
3687
|
+
*/
|
3688
|
+
preserveTimestamps?: boolean;
|
3689
|
+
/**
|
3690
|
+
* Copy directories recursively.
|
3691
|
+
* @default false
|
3692
|
+
*/
|
3693
|
+
recursive?: boolean;
|
3694
|
+
}
|
3695
|
+
/**
|
3696
|
+
* Asynchronously copies the entire directory structure from `src` to `dest`,
|
3697
|
+
* including subdirectories and files.
|
3698
|
+
*
|
3699
|
+
* When copying a directory to another directory, globs are not supported and
|
3700
|
+
* behavior is similar to `cp dir1/ dir2/`.
|
3701
|
+
* @since v16.7.0
|
3702
|
+
* @experimental
|
3703
|
+
* @param src source path to copy.
|
3704
|
+
* @param dest destination path to copy to.
|
3705
|
+
*/
|
3706
|
+
export function cp(source: string, destination: string, callback: (err: NodeJS.ErrnoException | null) => void): void;
|
3707
|
+
export function cp(source: string, destination: string, opts: CopyOptions, callback: (err: NodeJS.ErrnoException | null) => void): void;
|
3708
|
+
/**
|
3709
|
+
* Synchronously copies the entire directory structure from `src` to `dest`,
|
3710
|
+
* including subdirectories and files.
|
3711
|
+
*
|
3712
|
+
* When copying a directory to another directory, globs are not supported and
|
3713
|
+
* behavior is similar to `cp dir1/ dir2/`.
|
3714
|
+
* @since v16.7.0
|
3715
|
+
* @experimental
|
3716
|
+
* @param src source path to copy.
|
3717
|
+
* @param dest destination path to copy to.
|
3718
|
+
*/
|
3719
|
+
export function cpSync(source: string, destination: string, opts?: CopyOptions): void;
|
3720
|
+
}
|
3721
|
+
declare module 'node:fs' {
|
3722
|
+
export * from 'fs';
|
3723
|
+
}
|