rahad-all-downloader 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.cache/nix/binary-cache-v6.sqlite +0 -0
- package/.cache/nix/binary-cache-v6.sqlite-journal +0 -0
- package/.cache/replit/__replit_disk_meta.json +1 -0
- package/.cache/replit/modules/nodejs-20.res +1 -0
- package/.cache/replit/modules/replit.res +1 -0
- package/.cache/replit/modules.stamp +0 -0
- package/.cache/replit/nix/env.json +1 -0
- package/.cache/typescript/5.0/node_modules/.package-lock.json +12 -0
- package/.cache/typescript/5.0/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.0/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.0/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.0/package-lock.json +17 -0
- package/.cache/typescript/5.0/package.json +1 -0
- package/.cache/typescript/5.3/node_modules/.package-lock.json +99 -0
- package/.cache/typescript/5.3/node_modules/@types/node/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/@types/node/README.md +15 -0
- package/.cache/typescript/5.3/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.3/node_modules/@types/node/assert.d.ts +996 -0
- package/.cache/typescript/5.3/node_modules/@types/node/async_hooks.d.ts +539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/buffer.d.ts +2362 -0
- package/.cache/typescript/5.3/node_modules/@types/node/child_process.d.ts +1540 -0
- package/.cache/typescript/5.3/node_modules/@types/node/cluster.d.ts +432 -0
- package/.cache/typescript/5.3/node_modules/@types/node/console.d.ts +415 -0
- package/.cache/typescript/5.3/node_modules/@types/node/constants.d.ts +19 -0
- package/.cache/typescript/5.3/node_modules/@types/node/crypto.d.ts +4456 -0
- package/.cache/typescript/5.3/node_modules/@types/node/dgram.d.ts +586 -0
- package/.cache/typescript/5.3/node_modules/@types/node/diagnostics_channel.d.ts +191 -0
- package/.cache/typescript/5.3/node_modules/@types/node/dns/promises.d.ts +425 -0
- package/.cache/typescript/5.3/node_modules/@types/node/dns.d.ts +809 -0
- package/.cache/typescript/5.3/node_modules/@types/node/dom-events.d.ts +122 -0
- package/.cache/typescript/5.3/node_modules/@types/node/domain.d.ts +170 -0
- package/.cache/typescript/5.3/node_modules/@types/node/events.d.ts +879 -0
- package/.cache/typescript/5.3/node_modules/@types/node/fs/promises.d.ts +1239 -0
- package/.cache/typescript/5.3/node_modules/@types/node/fs.d.ts +4291 -0
- package/.cache/typescript/5.3/node_modules/@types/node/globals.d.ts +385 -0
- package/.cache/typescript/5.3/node_modules/@types/node/globals.global.d.ts +1 -0
- package/.cache/typescript/5.3/node_modules/@types/node/http.d.ts +1888 -0
- package/.cache/typescript/5.3/node_modules/@types/node/http2.d.ts +2382 -0
- package/.cache/typescript/5.3/node_modules/@types/node/https.d.ts +550 -0
- package/.cache/typescript/5.3/node_modules/@types/node/index.d.ts +88 -0
- package/.cache/typescript/5.3/node_modules/@types/node/inspector.d.ts +2747 -0
- package/.cache/typescript/5.3/node_modules/@types/node/module.d.ts +301 -0
- package/.cache/typescript/5.3/node_modules/@types/node/net.d.ts +949 -0
- package/.cache/typescript/5.3/node_modules/@types/node/os.d.ts +478 -0
- package/.cache/typescript/5.3/node_modules/@types/node/package.json +230 -0
- package/.cache/typescript/5.3/node_modules/@types/node/path.d.ts +191 -0
- package/.cache/typescript/5.3/node_modules/@types/node/perf_hooks.d.ts +639 -0
- package/.cache/typescript/5.3/node_modules/@types/node/process.d.ts +1539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/punycode.d.ts +117 -0
- package/.cache/typescript/5.3/node_modules/@types/node/querystring.d.ts +141 -0
- package/.cache/typescript/5.3/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/.cache/typescript/5.3/node_modules/@types/node/readline.d.ts +539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/repl.d.ts +430 -0
- package/.cache/typescript/5.3/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.3/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/.cache/typescript/5.3/node_modules/@types/node/stream/web.d.ts +350 -0
- package/.cache/typescript/5.3/node_modules/@types/node/stream.d.ts +1701 -0
- package/.cache/typescript/5.3/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.3/node_modules/@types/node/test.d.ts +1382 -0
- package/.cache/typescript/5.3/node_modules/@types/node/timers/promises.d.ts +93 -0
- package/.cache/typescript/5.3/node_modules/@types/node/timers.d.ts +240 -0
- package/.cache/typescript/5.3/node_modules/@types/node/tls.d.ts +1210 -0
- package/.cache/typescript/5.3/node_modules/@types/node/trace_events.d.ts +182 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/assert.d.ts +996 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/async_hooks.d.ts +539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/buffer.d.ts +2362 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/child_process.d.ts +1540 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/cluster.d.ts +432 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/console.d.ts +415 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/constants.d.ts +19 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/crypto.d.ts +4455 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dgram.d.ts +586 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +191 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns/promises.d.ts +425 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dns.d.ts +809 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/dom-events.d.ts +122 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/domain.d.ts +170 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/events.d.ts +879 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs/promises.d.ts +1239 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/fs.d.ts +4291 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.d.ts +385 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/globals.global.d.ts +1 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http.d.ts +1888 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/http2.d.ts +2382 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/https.d.ts +550 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/index.d.ts +88 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/inspector.d.ts +2747 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/module.d.ts +301 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/net.d.ts +949 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/os.d.ts +478 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/path.d.ts +191 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/perf_hooks.d.ts +639 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/process.d.ts +1539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/punycode.d.ts +117 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/querystring.d.ts +141 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline/promises.d.ts +150 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/readline.d.ts +539 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/repl.d.ts +430 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/promises.d.ts +83 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream/web.d.ts +350 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/stream.d.ts +1701 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/test.d.ts +1382 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers/promises.d.ts +93 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/timers.d.ts +240 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tls.d.ts +1210 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/trace_events.d.ts +182 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/tty.d.ts +208 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/url.d.ts +927 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/util.d.ts +2183 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/v8.d.ts +635 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/vm.d.ts +903 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/wasi.d.ts +158 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/worker_threads.d.ts +691 -0
- package/.cache/typescript/5.3/node_modules/@types/node/ts4.8/zlib.d.ts +517 -0
- package/.cache/typescript/5.3/node_modules/@types/node/tty.d.ts +208 -0
- package/.cache/typescript/5.3/node_modules/@types/node/url.d.ts +927 -0
- package/.cache/typescript/5.3/node_modules/@types/node/util.d.ts +2183 -0
- package/.cache/typescript/5.3/node_modules/@types/node/v8.d.ts +635 -0
- package/.cache/typescript/5.3/node_modules/@types/node/vm.d.ts +903 -0
- package/.cache/typescript/5.3/node_modules/@types/node/wasi.d.ts +158 -0
- package/.cache/typescript/5.3/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/.cache/typescript/5.3/node_modules/@types/node/zlib.d.ts +517 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/README.md +15 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/externals.d.ts +32 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/index.d.ts +214 -0
- package/.cache/typescript/5.3/node_modules/@types/node-fetch/package.json +83 -0
- package/.cache/typescript/5.3/node_modules/asynckit/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/asynckit/README.md +233 -0
- package/.cache/typescript/5.3/node_modules/asynckit/bench.js +76 -0
- package/.cache/typescript/5.3/node_modules/asynckit/index.js +6 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/abort.js +29 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/async.js +34 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/defer.js +26 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/iterate.js +75 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_asynckit.js +91 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_parallel.js +25 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial.js +25 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/readable_serial_ordered.js +29 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/state.js +37 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/streamify.js +141 -0
- package/.cache/typescript/5.3/node_modules/asynckit/lib/terminator.js +29 -0
- package/.cache/typescript/5.3/node_modules/asynckit/package.json +63 -0
- package/.cache/typescript/5.3/node_modules/asynckit/parallel.js +43 -0
- package/.cache/typescript/5.3/node_modules/asynckit/serial.js +17 -0
- package/.cache/typescript/5.3/node_modules/asynckit/serialOrdered.js +75 -0
- package/.cache/typescript/5.3/node_modules/asynckit/stream.js +21 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/License +19 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/Readme.md +138 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/lib/combined_stream.js +208 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/package.json +25 -0
- package/.cache/typescript/5.3/node_modules/combined-stream/yarn.lock +17 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/License +19 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/Makefile +7 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/Readme.md +141 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
- package/.cache/typescript/5.3/node_modules/delayed-stream/package.json +27 -0
- package/.cache/typescript/5.3/node_modules/form-data/License +19 -0
- package/.cache/typescript/5.3/node_modules/form-data/README.md.bak +358 -0
- package/.cache/typescript/5.3/node_modules/form-data/Readme.md +358 -0
- package/.cache/typescript/5.3/node_modules/form-data/index.d.ts +62 -0
- package/.cache/typescript/5.3/node_modules/form-data/lib/browser.js +2 -0
- package/.cache/typescript/5.3/node_modules/form-data/lib/form_data.js +501 -0
- package/.cache/typescript/5.3/node_modules/form-data/lib/populate.js +10 -0
- package/.cache/typescript/5.3/node_modules/form-data/package.json +68 -0
- package/.cache/typescript/5.3/node_modules/mime-db/HISTORY.md +507 -0
- package/.cache/typescript/5.3/node_modules/mime-db/LICENSE +23 -0
- package/.cache/typescript/5.3/node_modules/mime-db/README.md +100 -0
- package/.cache/typescript/5.3/node_modules/mime-db/db.json +8519 -0
- package/.cache/typescript/5.3/node_modules/mime-db/index.js +12 -0
- package/.cache/typescript/5.3/node_modules/mime-db/package.json +60 -0
- package/.cache/typescript/5.3/node_modules/mime-types/HISTORY.md +397 -0
- package/.cache/typescript/5.3/node_modules/mime-types/LICENSE +23 -0
- package/.cache/typescript/5.3/node_modules/mime-types/README.md +113 -0
- package/.cache/typescript/5.3/node_modules/mime-types/index.js +188 -0
- package/.cache/typescript/5.3/node_modules/mime-types/package.json +44 -0
- package/.cache/typescript/5.3/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.3/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.3/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.3/node_modules/undici-types/README.md +6 -0
- package/.cache/typescript/5.3/node_modules/undici-types/agent.d.ts +31 -0
- package/.cache/typescript/5.3/node_modules/undici-types/api.d.ts +43 -0
- package/.cache/typescript/5.3/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/.cache/typescript/5.3/node_modules/undici-types/cache.d.ts +36 -0
- package/.cache/typescript/5.3/node_modules/undici-types/client.d.ts +97 -0
- package/.cache/typescript/5.3/node_modules/undici-types/connector.d.ts +34 -0
- package/.cache/typescript/5.3/node_modules/undici-types/content-type.d.ts +21 -0
- package/.cache/typescript/5.3/node_modules/undici-types/cookies.d.ts +28 -0
- package/.cache/typescript/5.3/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/.cache/typescript/5.3/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/.cache/typescript/5.3/node_modules/undici-types/errors.d.ts +128 -0
- package/.cache/typescript/5.3/node_modules/undici-types/fetch.d.ts +209 -0
- package/.cache/typescript/5.3/node_modules/undici-types/file.d.ts +39 -0
- package/.cache/typescript/5.3/node_modules/undici-types/filereader.d.ts +54 -0
- package/.cache/typescript/5.3/node_modules/undici-types/formdata.d.ts +108 -0
- package/.cache/typescript/5.3/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/.cache/typescript/5.3/node_modules/undici-types/global-origin.d.ts +7 -0
- package/.cache/typescript/5.3/node_modules/undici-types/handlers.d.ts +9 -0
- package/.cache/typescript/5.3/node_modules/undici-types/header.d.ts +4 -0
- package/.cache/typescript/5.3/node_modules/undici-types/index.d.ts +63 -0
- package/.cache/typescript/5.3/node_modules/undici-types/interceptors.d.ts +5 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-client.d.ts +25 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/.cache/typescript/5.3/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/.cache/typescript/5.3/node_modules/undici-types/package.json +55 -0
- package/.cache/typescript/5.3/node_modules/undici-types/patch.d.ts +71 -0
- package/.cache/typescript/5.3/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/.cache/typescript/5.3/node_modules/undici-types/pool.d.ts +28 -0
- package/.cache/typescript/5.3/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/.cache/typescript/5.3/node_modules/undici-types/readable.d.ts +61 -0
- package/.cache/typescript/5.3/node_modules/undici-types/webidl.d.ts +220 -0
- package/.cache/typescript/5.3/node_modules/undici-types/websocket.d.ts +131 -0
- package/.cache/typescript/5.3/package-lock.json +107 -0
- package/.cache/typescript/5.3/package.json +1 -0
- package/.cache/typescript/5.4/node_modules/.package-lock.json +115 -0
- package/.cache/typescript/5.4/node_modules/@types/body-parser/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/body-parser/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/body-parser/index.d.ts +95 -0
- package/.cache/typescript/5.4/node_modules/@types/body-parser/package.json +58 -0
- package/.cache/typescript/5.4/node_modules/@types/connect/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/connect/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/connect/index.d.ts +91 -0
- package/.cache/typescript/5.4/node_modules/@types/connect/package.json +32 -0
- package/.cache/typescript/5.4/node_modules/@types/express/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/express/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/express/index.d.ts +128 -0
- package/.cache/typescript/5.4/node_modules/@types/express/package.json +45 -0
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/index.d.ts +1295 -0
- package/.cache/typescript/5.4/node_modules/@types/express-serve-static-core/package.json +50 -0
- package/.cache/typescript/5.4/node_modules/@types/http-errors/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/http-errors/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/http-errors/index.d.ts +77 -0
- package/.cache/typescript/5.4/node_modules/@types/http-errors/package.json +30 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/Mime.d.ts +10 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/index.d.ts +31 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/lite.d.ts +7 -0
- package/.cache/typescript/5.4/node_modules/@types/mime/package.json +30 -0
- package/.cache/typescript/5.4/node_modules/@types/node/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/node/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/.cache/typescript/5.4/node_modules/@types/node/assert.d.ts +1040 -0
- package/.cache/typescript/5.4/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/.cache/typescript/5.4/node_modules/@types/node/buffer.d.ts +2363 -0
- package/.cache/typescript/5.4/node_modules/@types/node/child_process.d.ts +1544 -0
- package/.cache/typescript/5.4/node_modules/@types/node/cluster.d.ts +578 -0
- package/.cache/typescript/5.4/node_modules/@types/node/console.d.ts +452 -0
- package/.cache/typescript/5.4/node_modules/@types/node/constants.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/@types/node/crypto.d.ts +4523 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dgram.d.ts +596 -0
- package/.cache/typescript/5.4/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns/promises.d.ts +474 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dns.d.ts +864 -0
- package/.cache/typescript/5.4/node_modules/@types/node/dom-events.d.ts +124 -0
- package/.cache/typescript/5.4/node_modules/@types/node/domain.d.ts +170 -0
- package/.cache/typescript/5.4/node_modules/@types/node/events.d.ts +909 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/.cache/typescript/5.4/node_modules/@types/node/fs.d.ts +4317 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.d.ts +411 -0
- package/.cache/typescript/5.4/node_modules/@types/node/globals.global.d.ts +1 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http.d.ts +1908 -0
- package/.cache/typescript/5.4/node_modules/@types/node/http2.d.ts +2418 -0
- package/.cache/typescript/5.4/node_modules/@types/node/https.d.ts +550 -0
- package/.cache/typescript/5.4/node_modules/@types/node/index.d.ts +89 -0
- package/.cache/typescript/5.4/node_modules/@types/node/inspector.d.ts +2746 -0
- package/.cache/typescript/5.4/node_modules/@types/node/module.d.ts +315 -0
- package/.cache/typescript/5.4/node_modules/@types/node/net.d.ts +999 -0
- package/.cache/typescript/5.4/node_modules/@types/node/os.d.ts +495 -0
- package/.cache/typescript/5.4/node_modules/@types/node/package.json +217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/path.d.ts +191 -0
- package/.cache/typescript/5.4/node_modules/@types/node/perf_hooks.d.ts +905 -0
- package/.cache/typescript/5.4/node_modules/@types/node/process.d.ts +1754 -0
- package/.cache/typescript/5.4/node_modules/@types/node/punycode.d.ts +117 -0
- package/.cache/typescript/5.4/node_modules/@types/node/querystring.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/.cache/typescript/5.4/node_modules/@types/node/readline.d.ts +540 -0
- package/.cache/typescript/5.4/node_modules/@types/node/repl.d.ts +430 -0
- package/.cache/typescript/5.4/node_modules/@types/node/sea.d.ts +153 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream/web.d.ts +367 -0
- package/.cache/typescript/5.4/node_modules/@types/node/stream.d.ts +1707 -0
- package/.cache/typescript/5.4/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/@types/node/test.d.ts +1718 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/@types/node/timers.d.ts +240 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tls.d.ts +1217 -0
- package/.cache/typescript/5.4/node_modules/@types/node/trace_events.d.ts +197 -0
- package/.cache/typescript/5.4/node_modules/@types/node/tty.d.ts +208 -0
- package/.cache/typescript/5.4/node_modules/@types/node/url.d.ts +952 -0
- package/.cache/typescript/5.4/node_modules/@types/node/util.d.ts +2292 -0
- package/.cache/typescript/5.4/node_modules/@types/node/v8.d.ts +808 -0
- package/.cache/typescript/5.4/node_modules/@types/node/vm.d.ts +924 -0
- package/.cache/typescript/5.4/node_modules/@types/node/wasi.d.ts +181 -0
- package/.cache/typescript/5.4/node_modules/@types/node/worker_threads.d.ts +691 -0
- package/.cache/typescript/5.4/node_modules/@types/node/zlib.d.ts +530 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/index.d.ts +79 -0
- package/.cache/typescript/5.4/node_modules/@types/qs/package.json +65 -0
- package/.cache/typescript/5.4/node_modules/@types/range-parser/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/range-parser/README.md +53 -0
- package/.cache/typescript/5.4/node_modules/@types/range-parser/index.d.ts +34 -0
- package/.cache/typescript/5.4/node_modules/@types/range-parser/package.json +25 -0
- package/.cache/typescript/5.4/node_modules/@types/send/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/send/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/send/index.d.ts +225 -0
- package/.cache/typescript/5.4/node_modules/@types/send/package.json +33 -0
- package/.cache/typescript/5.4/node_modules/@types/serve-static/LICENSE +21 -0
- package/.cache/typescript/5.4/node_modules/@types/serve-static/README.md +15 -0
- package/.cache/typescript/5.4/node_modules/@types/serve-static/index.d.ts +107 -0
- package/.cache/typescript/5.4/node_modules/@types/serve-static/package.json +39 -0
- package/.cache/typescript/5.4/node_modules/types-registry/README.md +2 -0
- package/.cache/typescript/5.4/node_modules/types-registry/index.json +1 -0
- package/.cache/typescript/5.4/node_modules/types-registry/package.json +20 -0
- package/.cache/typescript/5.4/node_modules/undici-types/README.md +6 -0
- package/.cache/typescript/5.4/node_modules/undici-types/agent.d.ts +31 -0
- package/.cache/typescript/5.4/node_modules/undici-types/api.d.ts +43 -0
- package/.cache/typescript/5.4/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cache.d.ts +36 -0
- package/.cache/typescript/5.4/node_modules/undici-types/client.d.ts +97 -0
- package/.cache/typescript/5.4/node_modules/undici-types/connector.d.ts +34 -0
- package/.cache/typescript/5.4/node_modules/undici-types/content-type.d.ts +21 -0
- package/.cache/typescript/5.4/node_modules/undici-types/cookies.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/.cache/typescript/5.4/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/.cache/typescript/5.4/node_modules/undici-types/errors.d.ts +128 -0
- package/.cache/typescript/5.4/node_modules/undici-types/fetch.d.ts +209 -0
- package/.cache/typescript/5.4/node_modules/undici-types/file.d.ts +39 -0
- package/.cache/typescript/5.4/node_modules/undici-types/filereader.d.ts +54 -0
- package/.cache/typescript/5.4/node_modules/undici-types/formdata.d.ts +108 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/global-origin.d.ts +7 -0
- package/.cache/typescript/5.4/node_modules/undici-types/handlers.d.ts +9 -0
- package/.cache/typescript/5.4/node_modules/undici-types/header.d.ts +4 -0
- package/.cache/typescript/5.4/node_modules/undici-types/index.d.ts +63 -0
- package/.cache/typescript/5.4/node_modules/undici-types/interceptors.d.ts +5 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-client.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/.cache/typescript/5.4/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/.cache/typescript/5.4/node_modules/undici-types/package.json +55 -0
- package/.cache/typescript/5.4/node_modules/undici-types/patch.d.ts +71 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/.cache/typescript/5.4/node_modules/undici-types/pool.d.ts +28 -0
- package/.cache/typescript/5.4/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/.cache/typescript/5.4/node_modules/undici-types/readable.d.ts +61 -0
- package/.cache/typescript/5.4/node_modules/undici-types/webidl.d.ts +220 -0
- package/.cache/typescript/5.4/node_modules/undici-types/websocket.d.ts +131 -0
- package/.cache/typescript/5.4/package-lock.json +124 -0
- package/.cache/typescript/5.4/package.json +1 -0
- package/.replit +21 -0
- package/.upm/store.json +1 -0
- package/README.md +71 -0
- package/index.js +1 -0
- package/package.json +40 -0
- package/replit.nix +3 -0
@@ -0,0 +1,999 @@
|
|
1
|
+
/**
|
2
|
+
* > Stability: 2 - Stable
|
3
|
+
*
|
4
|
+
* The `node:net` module provides an asynchronous network API for creating stream-based
|
5
|
+
* TCP or `IPC` servers ({@link createServer}) and clients
|
6
|
+
* ({@link createConnection}).
|
7
|
+
*
|
8
|
+
* It can be accessed using:
|
9
|
+
*
|
10
|
+
* ```js
|
11
|
+
* const net = require('node:net');
|
12
|
+
* ```
|
13
|
+
* @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/net.js)
|
14
|
+
*/
|
15
|
+
declare module "net" {
|
16
|
+
import * as stream from "node:stream";
|
17
|
+
import { Abortable, EventEmitter } from "node:events";
|
18
|
+
import * as dns from "node:dns";
|
19
|
+
type LookupFunction = (
|
20
|
+
hostname: string,
|
21
|
+
options: dns.LookupOptions,
|
22
|
+
callback: (err: NodeJS.ErrnoException | null, address: string | dns.LookupAddress[], family?: number) => void,
|
23
|
+
) => void;
|
24
|
+
interface AddressInfo {
|
25
|
+
address: string;
|
26
|
+
family: string;
|
27
|
+
port: number;
|
28
|
+
}
|
29
|
+
interface SocketConstructorOpts {
|
30
|
+
fd?: number | undefined;
|
31
|
+
allowHalfOpen?: boolean | undefined;
|
32
|
+
readable?: boolean | undefined;
|
33
|
+
writable?: boolean | undefined;
|
34
|
+
signal?: AbortSignal;
|
35
|
+
}
|
36
|
+
interface OnReadOpts {
|
37
|
+
buffer: Uint8Array | (() => Uint8Array);
|
38
|
+
/**
|
39
|
+
* This function is called for every chunk of incoming data.
|
40
|
+
* Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer.
|
41
|
+
* Return false from this function to implicitly pause() the socket.
|
42
|
+
*/
|
43
|
+
callback(bytesWritten: number, buf: Uint8Array): boolean;
|
44
|
+
}
|
45
|
+
interface ConnectOpts {
|
46
|
+
/**
|
47
|
+
* If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket.
|
48
|
+
* Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will
|
49
|
+
* still be emitted as normal and methods like pause() and resume() will also behave as expected.
|
50
|
+
*/
|
51
|
+
onread?: OnReadOpts | undefined;
|
52
|
+
}
|
53
|
+
interface TcpSocketConnectOpts extends ConnectOpts {
|
54
|
+
port: number;
|
55
|
+
host?: string | undefined;
|
56
|
+
localAddress?: string | undefined;
|
57
|
+
localPort?: number | undefined;
|
58
|
+
hints?: number | undefined;
|
59
|
+
family?: number | undefined;
|
60
|
+
lookup?: LookupFunction | undefined;
|
61
|
+
noDelay?: boolean | undefined;
|
62
|
+
keepAlive?: boolean | undefined;
|
63
|
+
keepAliveInitialDelay?: number | undefined;
|
64
|
+
/**
|
65
|
+
* @since v18.13.0
|
66
|
+
*/
|
67
|
+
autoSelectFamily?: boolean | undefined;
|
68
|
+
/**
|
69
|
+
* @since v18.13.0
|
70
|
+
*/
|
71
|
+
autoSelectFamilyAttemptTimeout?: number | undefined;
|
72
|
+
}
|
73
|
+
interface IpcSocketConnectOpts extends ConnectOpts {
|
74
|
+
path: string;
|
75
|
+
}
|
76
|
+
type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts;
|
77
|
+
type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed";
|
78
|
+
/**
|
79
|
+
* This class is an abstraction of a TCP socket or a streaming `IPC` endpoint
|
80
|
+
* (uses named pipes on Windows, and Unix domain sockets otherwise). It is also
|
81
|
+
* an `EventEmitter`.
|
82
|
+
*
|
83
|
+
* A `net.Socket` can be created by the user and used directly to interact with
|
84
|
+
* a server. For example, it is returned by {@link createConnection},
|
85
|
+
* so the user can use it to talk to the server.
|
86
|
+
*
|
87
|
+
* It can also be created by Node.js and passed to the user when a connection
|
88
|
+
* is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use
|
89
|
+
* it to interact with the client.
|
90
|
+
* @since v0.3.4
|
91
|
+
*/
|
92
|
+
class Socket extends stream.Duplex {
|
93
|
+
constructor(options?: SocketConstructorOpts);
|
94
|
+
/**
|
95
|
+
* Destroys the socket after all data is written. If the `finish` event was already emitted the socket is destroyed immediately.
|
96
|
+
* If the socket is still writable it implicitly calls `socket.end()`.
|
97
|
+
* @since v0.3.4
|
98
|
+
*/
|
99
|
+
destroySoon(): void;
|
100
|
+
/**
|
101
|
+
* Sends data on the socket. The second parameter specifies the encoding in the
|
102
|
+
* case of a string. It defaults to UTF8 encoding.
|
103
|
+
*
|
104
|
+
* Returns `true` if the entire data was flushed successfully to the kernel
|
105
|
+
* buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free.
|
106
|
+
*
|
107
|
+
* The optional `callback` parameter will be executed when the data is finally
|
108
|
+
* written out, which may not be immediately.
|
109
|
+
*
|
110
|
+
* See `Writable` stream `write()` method for more
|
111
|
+
* information.
|
112
|
+
* @since v0.1.90
|
113
|
+
* @param [encoding='utf8'] Only used when data is `string`.
|
114
|
+
*/
|
115
|
+
write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
116
|
+
write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean;
|
117
|
+
/**
|
118
|
+
* Initiate a connection on a given socket.
|
119
|
+
*
|
120
|
+
* Possible signatures:
|
121
|
+
*
|
122
|
+
* * `socket.connect(options[, connectListener])`
|
123
|
+
* * `socket.connect(path[, connectListener])` for `IPC` connections.
|
124
|
+
* * `socket.connect(port[, host][, connectListener])` for TCP connections.
|
125
|
+
* * Returns: `net.Socket` The socket itself.
|
126
|
+
*
|
127
|
+
* This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting,
|
128
|
+
* instead of a `'connect'` event, an `'error'` event will be emitted with
|
129
|
+
* the error passed to the `'error'` listener.
|
130
|
+
* The last parameter `connectListener`, if supplied, will be added as a listener
|
131
|
+
* for the `'connect'` event **once**.
|
132
|
+
*
|
133
|
+
* This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined
|
134
|
+
* behavior.
|
135
|
+
*/
|
136
|
+
connect(options: SocketConnectOpts, connectionListener?: () => void): this;
|
137
|
+
connect(port: number, host: string, connectionListener?: () => void): this;
|
138
|
+
connect(port: number, connectionListener?: () => void): this;
|
139
|
+
connect(path: string, connectionListener?: () => void): this;
|
140
|
+
/**
|
141
|
+
* Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information.
|
142
|
+
* @since v0.1.90
|
143
|
+
* @return The socket itself.
|
144
|
+
*/
|
145
|
+
setEncoding(encoding?: BufferEncoding): this;
|
146
|
+
/**
|
147
|
+
* Pauses the reading of data. That is, `'data'` events will not be emitted.
|
148
|
+
* Useful to throttle back an upload.
|
149
|
+
* @return The socket itself.
|
150
|
+
*/
|
151
|
+
pause(): this;
|
152
|
+
/**
|
153
|
+
* Close the TCP connection by sending an RST packet and destroy the stream.
|
154
|
+
* If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected.
|
155
|
+
* Otherwise, it will call `socket.destroy` with an `ERR_SOCKET_CLOSED` Error.
|
156
|
+
* If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an `ERR_INVALID_HANDLE_TYPE` Error.
|
157
|
+
* @since v18.3.0, v16.17.0
|
158
|
+
*/
|
159
|
+
resetAndDestroy(): this;
|
160
|
+
/**
|
161
|
+
* Resumes reading after a call to `socket.pause()`.
|
162
|
+
* @return The socket itself.
|
163
|
+
*/
|
164
|
+
resume(): this;
|
165
|
+
/**
|
166
|
+
* Sets the socket to timeout after `timeout` milliseconds of inactivity on
|
167
|
+
* the socket. By default `net.Socket` do not have a timeout.
|
168
|
+
*
|
169
|
+
* When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to
|
170
|
+
* end the connection.
|
171
|
+
*
|
172
|
+
* ```js
|
173
|
+
* socket.setTimeout(3000);
|
174
|
+
* socket.on('timeout', () => {
|
175
|
+
* console.log('socket timeout');
|
176
|
+
* socket.end();
|
177
|
+
* });
|
178
|
+
* ```
|
179
|
+
*
|
180
|
+
* If `timeout` is 0, then the existing idle timeout is disabled.
|
181
|
+
*
|
182
|
+
* The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event.
|
183
|
+
* @since v0.1.90
|
184
|
+
* @return The socket itself.
|
185
|
+
*/
|
186
|
+
setTimeout(timeout: number, callback?: () => void): this;
|
187
|
+
/**
|
188
|
+
* Enable/disable the use of Nagle's algorithm.
|
189
|
+
*
|
190
|
+
* When a TCP connection is created, it will have Nagle's algorithm enabled.
|
191
|
+
*
|
192
|
+
* Nagle's algorithm delays data before it is sent via the network. It attempts
|
193
|
+
* to optimize throughput at the expense of latency.
|
194
|
+
*
|
195
|
+
* Passing `true` for `noDelay` or not passing an argument will disable Nagle's
|
196
|
+
* algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's
|
197
|
+
* algorithm.
|
198
|
+
* @since v0.1.90
|
199
|
+
* @param [noDelay=true]
|
200
|
+
* @return The socket itself.
|
201
|
+
*/
|
202
|
+
setNoDelay(noDelay?: boolean): this;
|
203
|
+
/**
|
204
|
+
* Enable/disable keep-alive functionality, and optionally set the initial
|
205
|
+
* delay before the first keepalive probe is sent on an idle socket.
|
206
|
+
*
|
207
|
+
* Set `initialDelay` (in milliseconds) to set the delay between the last
|
208
|
+
* data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default
|
209
|
+
* (or previous) setting.
|
210
|
+
*
|
211
|
+
* Enabling the keep-alive functionality will set the following socket options:
|
212
|
+
*
|
213
|
+
* * `SO_KEEPALIVE=1`
|
214
|
+
* * `TCP_KEEPIDLE=initialDelay`
|
215
|
+
* * `TCP_KEEPCNT=10`
|
216
|
+
* * `TCP_KEEPINTVL=1`
|
217
|
+
* @since v0.1.92
|
218
|
+
* @param [enable=false]
|
219
|
+
* @param [initialDelay=0]
|
220
|
+
* @return The socket itself.
|
221
|
+
*/
|
222
|
+
setKeepAlive(enable?: boolean, initialDelay?: number): this;
|
223
|
+
/**
|
224
|
+
* Returns the bound `address`, the address `family` name and `port` of the
|
225
|
+
* socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
|
226
|
+
* @since v0.1.90
|
227
|
+
*/
|
228
|
+
address(): AddressInfo | {};
|
229
|
+
/**
|
230
|
+
* Calling `unref()` on a socket will allow the program to exit if this is the only
|
231
|
+
* active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect.
|
232
|
+
* @since v0.9.1
|
233
|
+
* @return The socket itself.
|
234
|
+
*/
|
235
|
+
unref(): this;
|
236
|
+
/**
|
237
|
+
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior).
|
238
|
+
* If the socket is `ref`ed calling `ref` again will have no effect.
|
239
|
+
* @since v0.9.1
|
240
|
+
* @return The socket itself.
|
241
|
+
*/
|
242
|
+
ref(): this;
|
243
|
+
/**
|
244
|
+
* This property is only present if the family autoselection algorithm is enabled in `socket.connect(options)`
|
245
|
+
* and it is an array of the addresses that have been attempted.
|
246
|
+
*
|
247
|
+
* Each address is a string in the form of `$IP:$PORT`.
|
248
|
+
* If the connection was successful, then the last address is the one that the socket is currently connected to.
|
249
|
+
* @since v19.4.0
|
250
|
+
*/
|
251
|
+
readonly autoSelectFamilyAttemptedAddresses: string[];
|
252
|
+
/**
|
253
|
+
* This property shows the number of characters buffered for writing. The buffer
|
254
|
+
* may contain strings whose length after encoding is not yet known. So this number
|
255
|
+
* is only an approximation of the number of bytes in the buffer.
|
256
|
+
*
|
257
|
+
* `net.Socket` has the property that `socket.write()` always works. This is to
|
258
|
+
* help users get up and running quickly. The computer cannot always keep up
|
259
|
+
* with the amount of data that is written to a socket. The network connection
|
260
|
+
* simply might be too slow. Node.js will internally queue up the data written to a
|
261
|
+
* socket and send it out over the wire when it is possible.
|
262
|
+
*
|
263
|
+
* The consequence of this internal buffering is that memory may grow.
|
264
|
+
* Users who experience large or growing `bufferSize` should attempt to
|
265
|
+
* "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`.
|
266
|
+
* @since v0.3.8
|
267
|
+
* @deprecated Since v14.6.0 - Use `writableLength` instead.
|
268
|
+
*/
|
269
|
+
readonly bufferSize: number;
|
270
|
+
/**
|
271
|
+
* The amount of received bytes.
|
272
|
+
* @since v0.5.3
|
273
|
+
*/
|
274
|
+
readonly bytesRead: number;
|
275
|
+
/**
|
276
|
+
* The amount of bytes sent.
|
277
|
+
* @since v0.5.3
|
278
|
+
*/
|
279
|
+
readonly bytesWritten: number;
|
280
|
+
/**
|
281
|
+
* If `true`, `socket.connect(options[, connectListener])` was
|
282
|
+
* called and has not yet finished. It will stay `true` until the socket becomes
|
283
|
+
* connected, then it is set to `false` and the `'connect'` event is emitted. Note
|
284
|
+
* that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event.
|
285
|
+
* @since v6.1.0
|
286
|
+
*/
|
287
|
+
readonly connecting: boolean;
|
288
|
+
/**
|
289
|
+
* This is `true` if the socket is not connected yet, either because `.connect()`has not yet been called or because it is still in the process of connecting
|
290
|
+
* (see `socket.connecting`).
|
291
|
+
* @since v11.2.0, v10.16.0
|
292
|
+
*/
|
293
|
+
readonly pending: boolean;
|
294
|
+
/**
|
295
|
+
* See `writable.destroyed` for further details.
|
296
|
+
*/
|
297
|
+
readonly destroyed: boolean;
|
298
|
+
/**
|
299
|
+
* The string representation of the local IP address the remote client is
|
300
|
+
* connecting on. For example, in a server listening on `'0.0.0.0'`, if a client
|
301
|
+
* connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`.
|
302
|
+
* @since v0.9.6
|
303
|
+
*/
|
304
|
+
readonly localAddress?: string;
|
305
|
+
/**
|
306
|
+
* The numeric representation of the local port. For example, `80` or `21`.
|
307
|
+
* @since v0.9.6
|
308
|
+
*/
|
309
|
+
readonly localPort?: number;
|
310
|
+
/**
|
311
|
+
* The string representation of the local IP family. `'IPv4'` or `'IPv6'`.
|
312
|
+
* @since v18.8.0, v16.18.0
|
313
|
+
*/
|
314
|
+
readonly localFamily?: string;
|
315
|
+
/**
|
316
|
+
* This property represents the state of the connection as a string.
|
317
|
+
*
|
318
|
+
* * If the stream is connecting `socket.readyState` is `opening`.
|
319
|
+
* * If the stream is readable and writable, it is `open`.
|
320
|
+
* * If the stream is readable and not writable, it is `readOnly`.
|
321
|
+
* * If the stream is not readable and writable, it is `writeOnly`.
|
322
|
+
* @since v0.5.0
|
323
|
+
*/
|
324
|
+
readonly readyState: SocketReadyState;
|
325
|
+
/**
|
326
|
+
* The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if
|
327
|
+
* the socket is destroyed (for example, if the client disconnected).
|
328
|
+
* @since v0.5.10
|
329
|
+
*/
|
330
|
+
readonly remoteAddress?: string | undefined;
|
331
|
+
/**
|
332
|
+
* The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if
|
333
|
+
* the socket is destroyed (for example, if the client disconnected).
|
334
|
+
* @since v0.11.14
|
335
|
+
*/
|
336
|
+
readonly remoteFamily?: string | undefined;
|
337
|
+
/**
|
338
|
+
* The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if
|
339
|
+
* the socket is destroyed (for example, if the client disconnected).
|
340
|
+
* @since v0.5.10
|
341
|
+
*/
|
342
|
+
readonly remotePort?: number | undefined;
|
343
|
+
/**
|
344
|
+
* The socket timeout in milliseconds as set by `socket.setTimeout()`.
|
345
|
+
* It is `undefined` if a timeout has not been set.
|
346
|
+
* @since v10.7.0
|
347
|
+
*/
|
348
|
+
readonly timeout?: number | undefined;
|
349
|
+
/**
|
350
|
+
* Half-closes the socket. i.e., it sends a FIN packet. It is possible the
|
351
|
+
* server will still send some data.
|
352
|
+
*
|
353
|
+
* See `writable.end()` for further details.
|
354
|
+
* @since v0.1.90
|
355
|
+
* @param [encoding='utf8'] Only used when data is `string`.
|
356
|
+
* @param callback Optional callback for when the socket is finished.
|
357
|
+
* @return The socket itself.
|
358
|
+
*/
|
359
|
+
end(callback?: () => void): this;
|
360
|
+
end(buffer: Uint8Array | string, callback?: () => void): this;
|
361
|
+
end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this;
|
362
|
+
/**
|
363
|
+
* events.EventEmitter
|
364
|
+
* 1. close
|
365
|
+
* 2. connect
|
366
|
+
* 3. connectionAttempt
|
367
|
+
* 4. connectionAttemptFailed
|
368
|
+
* 5. connectionAttemptTimeout
|
369
|
+
* 6. data
|
370
|
+
* 7. drain
|
371
|
+
* 8. end
|
372
|
+
* 9. error
|
373
|
+
* 10. lookup
|
374
|
+
* 11. ready
|
375
|
+
* 12. timeout
|
376
|
+
*/
|
377
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
378
|
+
addListener(event: "close", listener: (hadError: boolean) => void): this;
|
379
|
+
addListener(event: "connect", listener: () => void): this;
|
380
|
+
addListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
381
|
+
addListener(
|
382
|
+
event: "connectionAttemptFailed",
|
383
|
+
listener: (ip: string, port: number, family: number) => void,
|
384
|
+
): this;
|
385
|
+
addListener(
|
386
|
+
event: "connectionAttemptTimeout",
|
387
|
+
listener: (ip: string, port: number, family: number) => void,
|
388
|
+
): this;
|
389
|
+
addListener(event: "data", listener: (data: Buffer) => void): this;
|
390
|
+
addListener(event: "drain", listener: () => void): this;
|
391
|
+
addListener(event: "end", listener: () => void): this;
|
392
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
393
|
+
addListener(
|
394
|
+
event: "lookup",
|
395
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
396
|
+
): this;
|
397
|
+
addListener(event: "ready", listener: () => void): this;
|
398
|
+
addListener(event: "timeout", listener: () => void): this;
|
399
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
400
|
+
emit(event: "close", hadError: boolean): boolean;
|
401
|
+
emit(event: "connect"): boolean;
|
402
|
+
emit(event: "connectionAttempt", ip: string, port: number, family: number): boolean;
|
403
|
+
emit(event: "connectionAttemptFailed", ip: string, port: number, family: number): boolean;
|
404
|
+
emit(event: "connectionAttemptTimeout", ip: string, port: number, family: number): boolean;
|
405
|
+
emit(event: "data", data: Buffer): boolean;
|
406
|
+
emit(event: "drain"): boolean;
|
407
|
+
emit(event: "end"): boolean;
|
408
|
+
emit(event: "error", err: Error): boolean;
|
409
|
+
emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean;
|
410
|
+
emit(event: "ready"): boolean;
|
411
|
+
emit(event: "timeout"): boolean;
|
412
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
413
|
+
on(event: "close", listener: (hadError: boolean) => void): this;
|
414
|
+
on(event: "connect", listener: () => void): this;
|
415
|
+
on(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
416
|
+
on(event: "connectionAttemptFailed", listener: (ip: string, port: number, family: number) => void): this;
|
417
|
+
on(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this;
|
418
|
+
on(event: "data", listener: (data: Buffer) => void): this;
|
419
|
+
on(event: "drain", listener: () => void): this;
|
420
|
+
on(event: "end", listener: () => void): this;
|
421
|
+
on(event: "error", listener: (err: Error) => void): this;
|
422
|
+
on(
|
423
|
+
event: "lookup",
|
424
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
425
|
+
): this;
|
426
|
+
on(event: "ready", listener: () => void): this;
|
427
|
+
on(event: "timeout", listener: () => void): this;
|
428
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
429
|
+
once(event: "close", listener: (hadError: boolean) => void): this;
|
430
|
+
once(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
431
|
+
once(event: "connectionAttemptFailed", listener: (ip: string, port: number, family: number) => void): this;
|
432
|
+
once(event: "connectionAttemptTimeout", listener: (ip: string, port: number, family: number) => void): this;
|
433
|
+
once(event: "connect", listener: () => void): this;
|
434
|
+
once(event: "data", listener: (data: Buffer) => void): this;
|
435
|
+
once(event: "drain", listener: () => void): this;
|
436
|
+
once(event: "end", listener: () => void): this;
|
437
|
+
once(event: "error", listener: (err: Error) => void): this;
|
438
|
+
once(
|
439
|
+
event: "lookup",
|
440
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
441
|
+
): this;
|
442
|
+
once(event: "ready", listener: () => void): this;
|
443
|
+
once(event: "timeout", listener: () => void): this;
|
444
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
445
|
+
prependListener(event: "close", listener: (hadError: boolean) => void): this;
|
446
|
+
prependListener(event: "connect", listener: () => void): this;
|
447
|
+
prependListener(event: "connectionAttempt", listener: (ip: string, port: number, family: number) => void): this;
|
448
|
+
prependListener(
|
449
|
+
event: "connectionAttemptFailed",
|
450
|
+
listener: (ip: string, port: number, family: number) => void,
|
451
|
+
): this;
|
452
|
+
prependListener(
|
453
|
+
event: "connectionAttemptTimeout",
|
454
|
+
listener: (ip: string, port: number, family: number) => void,
|
455
|
+
): this;
|
456
|
+
prependListener(event: "data", listener: (data: Buffer) => void): this;
|
457
|
+
prependListener(event: "drain", listener: () => void): this;
|
458
|
+
prependListener(event: "end", listener: () => void): this;
|
459
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
460
|
+
prependListener(
|
461
|
+
event: "lookup",
|
462
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
463
|
+
): this;
|
464
|
+
prependListener(event: "ready", listener: () => void): this;
|
465
|
+
prependListener(event: "timeout", listener: () => void): this;
|
466
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
467
|
+
prependOnceListener(event: "close", listener: (hadError: boolean) => void): this;
|
468
|
+
prependOnceListener(event: "connect", listener: () => void): this;
|
469
|
+
prependOnceListener(
|
470
|
+
event: "connectionAttempt",
|
471
|
+
listener: (ip: string, port: number, family: number) => void,
|
472
|
+
): this;
|
473
|
+
prependOnceListener(
|
474
|
+
event: "connectionAttemptFailed",
|
475
|
+
listener: (ip: string, port: number, family: number) => void,
|
476
|
+
): this;
|
477
|
+
prependOnceListener(
|
478
|
+
event: "connectionAttemptTimeout",
|
479
|
+
listener: (ip: string, port: number, family: number) => void,
|
480
|
+
): this;
|
481
|
+
prependOnceListener(event: "data", listener: (data: Buffer) => void): this;
|
482
|
+
prependOnceListener(event: "drain", listener: () => void): this;
|
483
|
+
prependOnceListener(event: "end", listener: () => void): this;
|
484
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
485
|
+
prependOnceListener(
|
486
|
+
event: "lookup",
|
487
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
488
|
+
): this;
|
489
|
+
prependOnceListener(event: "ready", listener: () => void): this;
|
490
|
+
prependOnceListener(event: "timeout", listener: () => void): this;
|
491
|
+
}
|
492
|
+
interface ListenOptions extends Abortable {
|
493
|
+
port?: number | undefined;
|
494
|
+
host?: string | undefined;
|
495
|
+
backlog?: number | undefined;
|
496
|
+
path?: string | undefined;
|
497
|
+
exclusive?: boolean | undefined;
|
498
|
+
readableAll?: boolean | undefined;
|
499
|
+
writableAll?: boolean | undefined;
|
500
|
+
/**
|
501
|
+
* @default false
|
502
|
+
*/
|
503
|
+
ipv6Only?: boolean | undefined;
|
504
|
+
}
|
505
|
+
interface ServerOpts {
|
506
|
+
/**
|
507
|
+
* Indicates whether half-opened TCP connections are allowed.
|
508
|
+
* @default false
|
509
|
+
*/
|
510
|
+
allowHalfOpen?: boolean | undefined;
|
511
|
+
/**
|
512
|
+
* Indicates whether the socket should be paused on incoming connections.
|
513
|
+
* @default false
|
514
|
+
*/
|
515
|
+
pauseOnConnect?: boolean | undefined;
|
516
|
+
/**
|
517
|
+
* If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
|
518
|
+
* @default false
|
519
|
+
* @since v16.5.0
|
520
|
+
*/
|
521
|
+
noDelay?: boolean | undefined;
|
522
|
+
/**
|
523
|
+
* If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
|
524
|
+
* similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
|
525
|
+
* @default false
|
526
|
+
* @since v16.5.0
|
527
|
+
*/
|
528
|
+
keepAlive?: boolean | undefined;
|
529
|
+
/**
|
530
|
+
* If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
|
531
|
+
* @default 0
|
532
|
+
* @since v16.5.0
|
533
|
+
*/
|
534
|
+
keepAliveInitialDelay?: number | undefined;
|
535
|
+
}
|
536
|
+
interface DropArgument {
|
537
|
+
localAddress?: string;
|
538
|
+
localPort?: number;
|
539
|
+
localFamily?: string;
|
540
|
+
remoteAddress?: string;
|
541
|
+
remotePort?: number;
|
542
|
+
remoteFamily?: string;
|
543
|
+
}
|
544
|
+
/**
|
545
|
+
* This class is used to create a TCP or `IPC` server.
|
546
|
+
* @since v0.1.90
|
547
|
+
*/
|
548
|
+
class Server extends EventEmitter {
|
549
|
+
constructor(connectionListener?: (socket: Socket) => void);
|
550
|
+
constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void);
|
551
|
+
/**
|
552
|
+
* Start a server listening for connections. A `net.Server` can be a TCP or
|
553
|
+
* an `IPC` server depending on what it listens to.
|
554
|
+
*
|
555
|
+
* Possible signatures:
|
556
|
+
*
|
557
|
+
* * `server.listen(handle[, backlog][, callback])`
|
558
|
+
* * `server.listen(options[, callback])`
|
559
|
+
* * `server.listen(path[, backlog][, callback])` for `IPC` servers
|
560
|
+
* * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers
|
561
|
+
*
|
562
|
+
* This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'`
|
563
|
+
* event.
|
564
|
+
*
|
565
|
+
* All `listen()` methods can take a `backlog` parameter to specify the maximum
|
566
|
+
* length of the queue of pending connections. The actual length will be determined
|
567
|
+
* by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn` on Linux. The default value of this parameter is 511 (not 512).
|
568
|
+
*
|
569
|
+
* All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for
|
570
|
+
* details).
|
571
|
+
*
|
572
|
+
* The `server.listen()` method can be called again if and only if there was an
|
573
|
+
* error during the first `server.listen()` call or `server.close()` has been
|
574
|
+
* called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown.
|
575
|
+
*
|
576
|
+
* One of the most common errors raised when listening is `EADDRINUSE`.
|
577
|
+
* This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry
|
578
|
+
* after a certain amount of time:
|
579
|
+
*
|
580
|
+
* ```js
|
581
|
+
* server.on('error', (e) => {
|
582
|
+
* if (e.code === 'EADDRINUSE') {
|
583
|
+
* console.error('Address in use, retrying...');
|
584
|
+
* setTimeout(() => {
|
585
|
+
* server.close();
|
586
|
+
* server.listen(PORT, HOST);
|
587
|
+
* }, 1000);
|
588
|
+
* }
|
589
|
+
* });
|
590
|
+
* ```
|
591
|
+
*/
|
592
|
+
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
|
593
|
+
listen(port?: number, hostname?: string, listeningListener?: () => void): this;
|
594
|
+
listen(port?: number, backlog?: number, listeningListener?: () => void): this;
|
595
|
+
listen(port?: number, listeningListener?: () => void): this;
|
596
|
+
listen(path: string, backlog?: number, listeningListener?: () => void): this;
|
597
|
+
listen(path: string, listeningListener?: () => void): this;
|
598
|
+
listen(options: ListenOptions, listeningListener?: () => void): this;
|
599
|
+
listen(handle: any, backlog?: number, listeningListener?: () => void): this;
|
600
|
+
listen(handle: any, listeningListener?: () => void): this;
|
601
|
+
/**
|
602
|
+
* Stops the server from accepting new connections and keeps existing
|
603
|
+
* connections. This function is asynchronous, the server is finally closed
|
604
|
+
* when all connections are ended and the server emits a `'close'` event.
|
605
|
+
* The optional `callback` will be called once the `'close'` event occurs. Unlike
|
606
|
+
* that event, it will be called with an `Error` as its only argument if the server
|
607
|
+
* was not open when it was closed.
|
608
|
+
* @since v0.1.90
|
609
|
+
* @param callback Called when the server is closed.
|
610
|
+
*/
|
611
|
+
close(callback?: (err?: Error) => void): this;
|
612
|
+
/**
|
613
|
+
* Returns the bound `address`, the address `family` name, and `port` of the server
|
614
|
+
* as reported by the operating system if listening on an IP socket
|
615
|
+
* (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`.
|
616
|
+
*
|
617
|
+
* For a server listening on a pipe or Unix domain socket, the name is returned
|
618
|
+
* as a string.
|
619
|
+
*
|
620
|
+
* ```js
|
621
|
+
* const server = net.createServer((socket) => {
|
622
|
+
* socket.end('goodbye\n');
|
623
|
+
* }).on('error', (err) => {
|
624
|
+
* // Handle errors here.
|
625
|
+
* throw err;
|
626
|
+
* });
|
627
|
+
*
|
628
|
+
* // Grab an arbitrary unused port.
|
629
|
+
* server.listen(() => {
|
630
|
+
* console.log('opened server on', server.address());
|
631
|
+
* });
|
632
|
+
* ```
|
633
|
+
*
|
634
|
+
* `server.address()` returns `null` before the `'listening'` event has been
|
635
|
+
* emitted or after calling `server.close()`.
|
636
|
+
* @since v0.1.90
|
637
|
+
*/
|
638
|
+
address(): AddressInfo | string | null;
|
639
|
+
/**
|
640
|
+
* Asynchronously get the number of concurrent connections on the server. Works
|
641
|
+
* when sockets were sent to forks.
|
642
|
+
*
|
643
|
+
* Callback should take two arguments `err` and `count`.
|
644
|
+
* @since v0.9.7
|
645
|
+
*/
|
646
|
+
getConnections(cb: (error: Error | null, count: number) => void): void;
|
647
|
+
/**
|
648
|
+
* Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior).
|
649
|
+
* If the server is `ref`ed calling `ref()` again will have no effect.
|
650
|
+
* @since v0.9.1
|
651
|
+
*/
|
652
|
+
ref(): this;
|
653
|
+
/**
|
654
|
+
* Calling `unref()` on a server will allow the program to exit if this is the only
|
655
|
+
* active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect.
|
656
|
+
* @since v0.9.1
|
657
|
+
*/
|
658
|
+
unref(): this;
|
659
|
+
/**
|
660
|
+
* Set this property to reject connections when the server's connection count gets
|
661
|
+
* high.
|
662
|
+
*
|
663
|
+
* It is not recommended to use this option once a socket has been sent to a child
|
664
|
+
* with `child_process.fork()`.
|
665
|
+
* @since v0.2.0
|
666
|
+
*/
|
667
|
+
maxConnections: number;
|
668
|
+
connections: number;
|
669
|
+
/**
|
670
|
+
* Indicates whether or not the server is listening for connections.
|
671
|
+
* @since v5.7.0
|
672
|
+
*/
|
673
|
+
readonly listening: boolean;
|
674
|
+
/**
|
675
|
+
* events.EventEmitter
|
676
|
+
* 1. close
|
677
|
+
* 2. connection
|
678
|
+
* 3. error
|
679
|
+
* 4. listening
|
680
|
+
* 5. drop
|
681
|
+
*/
|
682
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
683
|
+
addListener(event: "close", listener: () => void): this;
|
684
|
+
addListener(event: "connection", listener: (socket: Socket) => void): this;
|
685
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
686
|
+
addListener(event: "listening", listener: () => void): this;
|
687
|
+
addListener(event: "drop", listener: (data?: DropArgument) => void): this;
|
688
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
689
|
+
emit(event: "close"): boolean;
|
690
|
+
emit(event: "connection", socket: Socket): boolean;
|
691
|
+
emit(event: "error", err: Error): boolean;
|
692
|
+
emit(event: "listening"): boolean;
|
693
|
+
emit(event: "drop", data?: DropArgument): boolean;
|
694
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
695
|
+
on(event: "close", listener: () => void): this;
|
696
|
+
on(event: "connection", listener: (socket: Socket) => void): this;
|
697
|
+
on(event: "error", listener: (err: Error) => void): this;
|
698
|
+
on(event: "listening", listener: () => void): this;
|
699
|
+
on(event: "drop", listener: (data?: DropArgument) => void): this;
|
700
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
701
|
+
once(event: "close", listener: () => void): this;
|
702
|
+
once(event: "connection", listener: (socket: Socket) => void): this;
|
703
|
+
once(event: "error", listener: (err: Error) => void): this;
|
704
|
+
once(event: "listening", listener: () => void): this;
|
705
|
+
once(event: "drop", listener: (data?: DropArgument) => void): this;
|
706
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
707
|
+
prependListener(event: "close", listener: () => void): this;
|
708
|
+
prependListener(event: "connection", listener: (socket: Socket) => void): this;
|
709
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
710
|
+
prependListener(event: "listening", listener: () => void): this;
|
711
|
+
prependListener(event: "drop", listener: (data?: DropArgument) => void): this;
|
712
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
713
|
+
prependOnceListener(event: "close", listener: () => void): this;
|
714
|
+
prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
|
715
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
716
|
+
prependOnceListener(event: "listening", listener: () => void): this;
|
717
|
+
prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this;
|
718
|
+
/**
|
719
|
+
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
|
720
|
+
* @since v20.5.0
|
721
|
+
*/
|
722
|
+
[Symbol.asyncDispose](): Promise<void>;
|
723
|
+
}
|
724
|
+
type IPVersion = "ipv4" | "ipv6";
|
725
|
+
/**
|
726
|
+
* The `BlockList` object can be used with some network APIs to specify rules for
|
727
|
+
* disabling inbound or outbound access to specific IP addresses, IP ranges, or
|
728
|
+
* IP subnets.
|
729
|
+
* @since v15.0.0, v14.18.0
|
730
|
+
*/
|
731
|
+
class BlockList {
|
732
|
+
/**
|
733
|
+
* Adds a rule to block the given IP address.
|
734
|
+
* @since v15.0.0, v14.18.0
|
735
|
+
* @param address An IPv4 or IPv6 address.
|
736
|
+
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
737
|
+
*/
|
738
|
+
addAddress(address: string, type?: IPVersion): void;
|
739
|
+
addAddress(address: SocketAddress): void;
|
740
|
+
/**
|
741
|
+
* Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive).
|
742
|
+
* @since v15.0.0, v14.18.0
|
743
|
+
* @param start The starting IPv4 or IPv6 address in the range.
|
744
|
+
* @param end The ending IPv4 or IPv6 address in the range.
|
745
|
+
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
746
|
+
*/
|
747
|
+
addRange(start: string, end: string, type?: IPVersion): void;
|
748
|
+
addRange(start: SocketAddress, end: SocketAddress): void;
|
749
|
+
/**
|
750
|
+
* Adds a rule to block a range of IP addresses specified as a subnet mask.
|
751
|
+
* @since v15.0.0, v14.18.0
|
752
|
+
* @param net The network IPv4 or IPv6 address.
|
753
|
+
* @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`.
|
754
|
+
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
755
|
+
*/
|
756
|
+
addSubnet(net: SocketAddress, prefix: number): void;
|
757
|
+
addSubnet(net: string, prefix: number, type?: IPVersion): void;
|
758
|
+
/**
|
759
|
+
* Returns `true` if the given IP address matches any of the rules added to the`BlockList`.
|
760
|
+
*
|
761
|
+
* ```js
|
762
|
+
* const blockList = new net.BlockList();
|
763
|
+
* blockList.addAddress('123.123.123.123');
|
764
|
+
* blockList.addRange('10.0.0.1', '10.0.0.10');
|
765
|
+
* blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6');
|
766
|
+
*
|
767
|
+
* console.log(blockList.check('123.123.123.123')); // Prints: true
|
768
|
+
* console.log(blockList.check('10.0.0.3')); // Prints: true
|
769
|
+
* console.log(blockList.check('222.111.111.222')); // Prints: false
|
770
|
+
*
|
771
|
+
* // IPv6 notation for IPv4 addresses works:
|
772
|
+
* console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true
|
773
|
+
* console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true
|
774
|
+
* ```
|
775
|
+
* @since v15.0.0, v14.18.0
|
776
|
+
* @param address The IP address to check
|
777
|
+
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
778
|
+
*/
|
779
|
+
check(address: SocketAddress): boolean;
|
780
|
+
check(address: string, type?: IPVersion): boolean;
|
781
|
+
/**
|
782
|
+
* The list of rules added to the blocklist.
|
783
|
+
* @since v15.0.0, v14.18.0
|
784
|
+
*/
|
785
|
+
rules: readonly string[];
|
786
|
+
}
|
787
|
+
interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts {
|
788
|
+
timeout?: number | undefined;
|
789
|
+
}
|
790
|
+
interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts {
|
791
|
+
timeout?: number | undefined;
|
792
|
+
}
|
793
|
+
type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts;
|
794
|
+
/**
|
795
|
+
* Creates a new TCP or `IPC` server.
|
796
|
+
*
|
797
|
+
* If `allowHalfOpen` is set to `true`, when the other end of the socket
|
798
|
+
* signals the end of transmission, the server will only send back the end of
|
799
|
+
* transmission when `socket.end()` is explicitly called. For example, in the
|
800
|
+
* context of TCP, when a FIN packed is received, a FIN packed is sent
|
801
|
+
* back only when `socket.end()` is explicitly called. Until then the
|
802
|
+
* connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information.
|
803
|
+
*
|
804
|
+
* If `pauseOnConnect` is set to `true`, then the socket associated with each
|
805
|
+
* incoming connection will be paused, and no data will be read from its handle.
|
806
|
+
* This allows connections to be passed between processes without any data being
|
807
|
+
* read by the original process. To begin reading data from a paused socket, call `socket.resume()`.
|
808
|
+
*
|
809
|
+
* The server can be a TCP server or an `IPC` server, depending on what it `listen()` to.
|
810
|
+
*
|
811
|
+
* Here is an example of a TCP echo server which listens for connections
|
812
|
+
* on port 8124:
|
813
|
+
*
|
814
|
+
* ```js
|
815
|
+
* const net = require('node:net');
|
816
|
+
* const server = net.createServer((c) => {
|
817
|
+
* // 'connection' listener.
|
818
|
+
* console.log('client connected');
|
819
|
+
* c.on('end', () => {
|
820
|
+
* console.log('client disconnected');
|
821
|
+
* });
|
822
|
+
* c.write('hello\r\n');
|
823
|
+
* c.pipe(c);
|
824
|
+
* });
|
825
|
+
* server.on('error', (err) => {
|
826
|
+
* throw err;
|
827
|
+
* });
|
828
|
+
* server.listen(8124, () => {
|
829
|
+
* console.log('server bound');
|
830
|
+
* });
|
831
|
+
* ```
|
832
|
+
*
|
833
|
+
* Test this by using `telnet`:
|
834
|
+
*
|
835
|
+
* ```bash
|
836
|
+
* telnet localhost 8124
|
837
|
+
* ```
|
838
|
+
*
|
839
|
+
* To listen on the socket `/tmp/echo.sock`:
|
840
|
+
*
|
841
|
+
* ```js
|
842
|
+
* server.listen('/tmp/echo.sock', () => {
|
843
|
+
* console.log('server bound');
|
844
|
+
* });
|
845
|
+
* ```
|
846
|
+
*
|
847
|
+
* Use `nc` to connect to a Unix domain socket server:
|
848
|
+
*
|
849
|
+
* ```bash
|
850
|
+
* nc -U /tmp/echo.sock
|
851
|
+
* ```
|
852
|
+
* @since v0.5.0
|
853
|
+
* @param connectionListener Automatically set as a listener for the {@link 'connection'} event.
|
854
|
+
*/
|
855
|
+
function createServer(connectionListener?: (socket: Socket) => void): Server;
|
856
|
+
function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server;
|
857
|
+
/**
|
858
|
+
* Aliases to {@link createConnection}.
|
859
|
+
*
|
860
|
+
* Possible signatures:
|
861
|
+
*
|
862
|
+
* * {@link connect}
|
863
|
+
* * {@link connect} for `IPC` connections.
|
864
|
+
* * {@link connect} for TCP connections.
|
865
|
+
*/
|
866
|
+
function connect(options: NetConnectOpts, connectionListener?: () => void): Socket;
|
867
|
+
function connect(port: number, host?: string, connectionListener?: () => void): Socket;
|
868
|
+
function connect(path: string, connectionListener?: () => void): Socket;
|
869
|
+
/**
|
870
|
+
* A factory function, which creates a new {@link Socket},
|
871
|
+
* immediately initiates connection with `socket.connect()`,
|
872
|
+
* then returns the `net.Socket` that starts the connection.
|
873
|
+
*
|
874
|
+
* When the connection is established, a `'connect'` event will be emitted
|
875
|
+
* on the returned socket. The last parameter `connectListener`, if supplied,
|
876
|
+
* will be added as a listener for the `'connect'` event **once**.
|
877
|
+
*
|
878
|
+
* Possible signatures:
|
879
|
+
*
|
880
|
+
* * {@link createConnection}
|
881
|
+
* * {@link createConnection} for `IPC` connections.
|
882
|
+
* * {@link createConnection} for TCP connections.
|
883
|
+
*
|
884
|
+
* The {@link connect} function is an alias to this function.
|
885
|
+
*/
|
886
|
+
function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket;
|
887
|
+
function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
|
888
|
+
function createConnection(path: string, connectionListener?: () => void): Socket;
|
889
|
+
/**
|
890
|
+
* Gets the current default value of the `autoSelectFamily` option of `socket.connect(options)`.
|
891
|
+
* The initial default value is `true`, unless the command line option`--no-network-family-autoselection` is provided.
|
892
|
+
* @since v19.4.0
|
893
|
+
*/
|
894
|
+
function getDefaultAutoSelectFamily(): boolean;
|
895
|
+
/**
|
896
|
+
* Sets the default value of the `autoSelectFamily` option of `socket.connect(options)`.
|
897
|
+
* @since v19.4.0
|
898
|
+
*/
|
899
|
+
function setDefaultAutoSelectFamily(value: boolean): void;
|
900
|
+
/**
|
901
|
+
* Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
|
902
|
+
* The initial default value is `250` or the value specified via the command line option `--network-family-autoselection-attempt-timeout`.
|
903
|
+
* @returns The current default value of the `autoSelectFamilyAttemptTimeout` option.
|
904
|
+
* @since v19.8.0, v18.8.0
|
905
|
+
*/
|
906
|
+
function getDefaultAutoSelectFamilyAttemptTimeout(): number;
|
907
|
+
/**
|
908
|
+
* Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
|
909
|
+
* @param value The new default value, which must be a positive number. If the number is less than `10`, the value `10` is used instead. The initial default value is `250` or the value specified via the command line
|
910
|
+
* option `--network-family-autoselection-attempt-timeout`.
|
911
|
+
* @since v19.8.0, v18.8.0
|
912
|
+
*/
|
913
|
+
function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void;
|
914
|
+
/**
|
915
|
+
* Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
|
916
|
+
* address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`.
|
917
|
+
*
|
918
|
+
* ```js
|
919
|
+
* net.isIP('::1'); // returns 6
|
920
|
+
* net.isIP('127.0.0.1'); // returns 4
|
921
|
+
* net.isIP('127.000.000.001'); // returns 0
|
922
|
+
* net.isIP('127.0.0.1/24'); // returns 0
|
923
|
+
* net.isIP('fhqwhgads'); // returns 0
|
924
|
+
* ```
|
925
|
+
* @since v0.3.0
|
926
|
+
*/
|
927
|
+
function isIP(input: string): number;
|
928
|
+
/**
|
929
|
+
* Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no
|
930
|
+
* leading zeroes. Otherwise, returns `false`.
|
931
|
+
*
|
932
|
+
* ```js
|
933
|
+
* net.isIPv4('127.0.0.1'); // returns true
|
934
|
+
* net.isIPv4('127.000.000.001'); // returns false
|
935
|
+
* net.isIPv4('127.0.0.1/24'); // returns false
|
936
|
+
* net.isIPv4('fhqwhgads'); // returns false
|
937
|
+
* ```
|
938
|
+
* @since v0.3.0
|
939
|
+
*/
|
940
|
+
function isIPv4(input: string): boolean;
|
941
|
+
/**
|
942
|
+
* Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
|
943
|
+
*
|
944
|
+
* ```js
|
945
|
+
* net.isIPv6('::1'); // returns true
|
946
|
+
* net.isIPv6('fhqwhgads'); // returns false
|
947
|
+
* ```
|
948
|
+
* @since v0.3.0
|
949
|
+
*/
|
950
|
+
function isIPv6(input: string): boolean;
|
951
|
+
interface SocketAddressInitOptions {
|
952
|
+
/**
|
953
|
+
* The network address as either an IPv4 or IPv6 string.
|
954
|
+
* @default 127.0.0.1
|
955
|
+
*/
|
956
|
+
address?: string | undefined;
|
957
|
+
/**
|
958
|
+
* @default `'ipv4'`
|
959
|
+
*/
|
960
|
+
family?: IPVersion | undefined;
|
961
|
+
/**
|
962
|
+
* An IPv6 flow-label used only if `family` is `'ipv6'`.
|
963
|
+
* @default 0
|
964
|
+
*/
|
965
|
+
flowlabel?: number | undefined;
|
966
|
+
/**
|
967
|
+
* An IP port.
|
968
|
+
* @default 0
|
969
|
+
*/
|
970
|
+
port?: number | undefined;
|
971
|
+
}
|
972
|
+
/**
|
973
|
+
* @since v15.14.0, v14.18.0
|
974
|
+
*/
|
975
|
+
class SocketAddress {
|
976
|
+
constructor(options: SocketAddressInitOptions);
|
977
|
+
/**
|
978
|
+
* Either \`'ipv4'\` or \`'ipv6'\`.
|
979
|
+
* @since v15.14.0, v14.18.0
|
980
|
+
*/
|
981
|
+
readonly address: string;
|
982
|
+
/**
|
983
|
+
* Either \`'ipv4'\` or \`'ipv6'\`.
|
984
|
+
* @since v15.14.0, v14.18.0
|
985
|
+
*/
|
986
|
+
readonly family: IPVersion;
|
987
|
+
/**
|
988
|
+
* @since v15.14.0, v14.18.0
|
989
|
+
*/
|
990
|
+
readonly port: number;
|
991
|
+
/**
|
992
|
+
* @since v15.14.0, v14.18.0
|
993
|
+
*/
|
994
|
+
readonly flowlabel: number;
|
995
|
+
}
|
996
|
+
}
|
997
|
+
declare module "node:net" {
|
998
|
+
export * from "net";
|
999
|
+
}
|