rahad-media-downloader 1.0.2
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:v32-20240401-269b323.res +1 -0
- package/.cache/replit/modules/replit:v8-20240329-787bc7d.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 +181 -0
- package/.cache/typescript/5.3/node_modules/@types/caseless/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/@types/caseless/README.md +48 -0
- package/.cache/typescript/5.3/node_modules/@types/caseless/index.d.ts +29 -0
- package/.cache/typescript/5.3/node_modules/@types/caseless/package.json +35 -0
- package/.cache/typescript/5.3/node_modules/@types/cheerio/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/@types/cheerio/README.md +15 -0
- package/.cache/typescript/5.3/node_modules/@types/cheerio/index.d.ts +318 -0
- package/.cache/typescript/5.3/node_modules/@types/cheerio/package.json +71 -0
- package/.cache/typescript/5.3/node_modules/@types/jsdom/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/@types/jsdom/README.md +15 -0
- package/.cache/typescript/5.3/node_modules/@types/jsdom/base.d.ts +456 -0
- package/.cache/typescript/5.3/node_modules/@types/jsdom/index.d.ts +18 -0
- package/.cache/typescript/5.3/node_modules/@types/jsdom/package.json +45 -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/@types/request/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/@types/request/README.md +15 -0
- package/.cache/typescript/5.3/node_modules/@types/request/index.d.ts +395 -0
- package/.cache/typescript/5.3/node_modules/@types/request/node_modules/form-data/License +19 -0
- package/.cache/typescript/5.3/node_modules/@types/request/node_modules/form-data/README.md +350 -0
- package/.cache/typescript/5.3/node_modules/@types/request/node_modules/form-data/README.md.bak +350 -0
- package/.cache/typescript/5.3/node_modules/@types/request/node_modules/form-data/index.d.ts +51 -0
- package/.cache/typescript/5.3/node_modules/@types/request/node_modules/form-data/lib/browser.js +2 -0
- package/.cache/typescript/5.3/node_modules/@types/request/node_modules/form-data/lib/form_data.js +483 -0
- package/.cache/typescript/5.3/node_modules/@types/request/node_modules/form-data/lib/populate.js +10 -0
- package/.cache/typescript/5.3/node_modules/@types/request/node_modules/form-data/package.json +68 -0
- package/.cache/typescript/5.3/node_modules/@types/request/package.json +70 -0
- package/.cache/typescript/5.3/node_modules/@types/tough-cookie/LICENSE +21 -0
- package/.cache/typescript/5.3/node_modules/@types/tough-cookie/README.md +15 -0
- package/.cache/typescript/5.3/node_modules/@types/tough-cookie/index.d.ts +321 -0
- package/.cache/typescript/5.3/node_modules/@types/tough-cookie/package.json +35 -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/entities/LICENSE +11 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/decode.d.ts +211 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/decode.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/decode.js +536 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/decode.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/decode_codepoint.d.ts +19 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/decode_codepoint.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/decode_codepoint.js +76 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/decode_codepoint.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/encode.d.ts +22 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/encode.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/encode.js +77 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/encode.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/escape.d.ts +43 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/escape.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/escape.js +122 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/escape.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/decode.d.ts +211 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/decode.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/decode.js +496 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/decode.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/decode_codepoint.d.ts +19 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/decode_codepoint.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/decode_codepoint.js +71 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/decode_codepoint.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/encode.d.ts +22 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/encode.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/encode.js +69 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/encode.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/escape.d.ts +43 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/escape.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/escape.js +116 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/escape.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/decode-data-html.d.ts +3 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/decode-data-html.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/decode-data-html.js +7 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/decode-data-html.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts +3 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/decode-data-xml.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/decode-data-xml.js +7 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/decode-data-xml.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/encode-html.d.ts +8 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/encode-html.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/encode-html.js +10 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/generated/encode-html.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/index.d.ts +96 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/index.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/index.js +99 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/index.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/esm/package.json +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/decode-data-html.d.ts +3 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/decode-data-html.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/decode-data-html.js +9 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/decode-data-html.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/decode-data-xml.d.ts +3 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/decode-data-xml.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/decode-data-xml.js +9 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/decode-data-xml.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/encode-html.d.ts +8 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/encode-html.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/encode-html.js +12 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/generated/encode-html.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/index.d.ts +96 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/index.d.ts.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/index.js +126 -0
- package/.cache/typescript/5.3/node_modules/entities/lib/index.js.map +1 -0
- package/.cache/typescript/5.3/node_modules/entities/package.json +90 -0
- package/.cache/typescript/5.3/node_modules/entities/readme.md +122 -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/parse5/LICENSE +19 -0
- package/.cache/typescript/5.3/node_modules/parse5/README.md +38 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/doctype.d.ts +5 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/doctype.js +120 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/error-codes.d.ts +68 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/error-codes.js +67 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/foreign-content.d.ts +10 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/foreign-content.js +239 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/html.d.ts +288 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/html.js +529 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/token.d.ts +85 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/token.js +25 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/unicode.d.ts +49 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/common/unicode.js +77 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/index.d.ts +60 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/index.js +57 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/package.json +1 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/parser/formatting-element-list.d.ts +37 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/parser/formatting-element-list.js +115 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/parser/index.d.ts +157 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/parser/index.js +3163 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/parser/open-element-stack.d.ts +53 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/parser/open-element-stack.js +316 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/serializer/index.d.ts +61 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/serializer/index.js +173 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/tokenizer/index.d.ts +248 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/tokenizer/index.js +2908 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/tokenizer/preprocessor.d.ts +37 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/tokenizer/preprocessor.js +199 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/tree-adapters/default.d.ts +85 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/tree-adapters/default.js +177 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/tree-adapters/interface.d.ts +250 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/cjs/tree-adapters/interface.js +3 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/doctype.d.ts +5 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/doctype.js +115 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/error-codes.d.ts +68 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/error-codes.js +64 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/foreign-content.d.ts +10 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/foreign-content.js +230 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/html.d.ts +288 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/html.js +523 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/token.d.ts +85 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/token.js +21 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/unicode.d.ts +49 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/common/unicode.js +69 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/index.d.ts +60 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/index.js +45 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/parser/formatting-element-list.d.ts +37 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/parser/formatting-element-list.js +111 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/parser/index.d.ts +157 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/parser/index.js +3168 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/parser/open-element-stack.d.ts +53 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/parser/open-element-stack.js +312 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/serializer/index.d.ts +61 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/serializer/index.js +168 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/tokenizer/index.d.ts +248 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/tokenizer/index.js +2904 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/tokenizer/preprocessor.d.ts +37 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/tokenizer/preprocessor.js +195 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/tree-adapters/default.d.ts +85 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/tree-adapters/default.js +174 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/tree-adapters/interface.d.ts +250 -0
- package/.cache/typescript/5.3/node_modules/parse5/dist/tree-adapters/interface.js +2 -0
- package/.cache/typescript/5.3/node_modules/parse5/package.json +50 -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 +192 -0
- package/.cache/typescript/5.3/package.json +1 -0
- package/.replit +17 -0
- package/README.md +130 -0
- package/index.js +1 -0
- package/package.json +28 -0
- package/replit.nix +3 -0
@@ -0,0 +1,949 @@
|
|
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.2.0/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.LookupAllOptions,
|
22
|
+
callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => 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. data
|
367
|
+
* 4. drain
|
368
|
+
* 5. end
|
369
|
+
* 6. error
|
370
|
+
* 7. lookup
|
371
|
+
* 8. ready
|
372
|
+
* 9. timeout
|
373
|
+
*/
|
374
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
375
|
+
addListener(event: "close", listener: (hadError: boolean) => void): this;
|
376
|
+
addListener(event: "connect", listener: () => void): this;
|
377
|
+
addListener(event: "data", listener: (data: Buffer) => void): this;
|
378
|
+
addListener(event: "drain", listener: () => void): this;
|
379
|
+
addListener(event: "end", listener: () => void): this;
|
380
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
381
|
+
addListener(
|
382
|
+
event: "lookup",
|
383
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
384
|
+
): this;
|
385
|
+
addListener(event: "ready", listener: () => void): this;
|
386
|
+
addListener(event: "timeout", listener: () => void): this;
|
387
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
388
|
+
emit(event: "close", hadError: boolean): boolean;
|
389
|
+
emit(event: "connect"): boolean;
|
390
|
+
emit(event: "data", data: Buffer): boolean;
|
391
|
+
emit(event: "drain"): boolean;
|
392
|
+
emit(event: "end"): boolean;
|
393
|
+
emit(event: "error", err: Error): boolean;
|
394
|
+
emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean;
|
395
|
+
emit(event: "ready"): boolean;
|
396
|
+
emit(event: "timeout"): boolean;
|
397
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
398
|
+
on(event: "close", listener: (hadError: boolean) => void): this;
|
399
|
+
on(event: "connect", listener: () => void): this;
|
400
|
+
on(event: "data", listener: (data: Buffer) => void): this;
|
401
|
+
on(event: "drain", listener: () => void): this;
|
402
|
+
on(event: "end", listener: () => void): this;
|
403
|
+
on(event: "error", listener: (err: Error) => void): this;
|
404
|
+
on(
|
405
|
+
event: "lookup",
|
406
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
407
|
+
): this;
|
408
|
+
on(event: "ready", listener: () => void): this;
|
409
|
+
on(event: "timeout", listener: () => void): this;
|
410
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
411
|
+
once(event: "close", listener: (hadError: boolean) => void): this;
|
412
|
+
once(event: "connect", listener: () => void): this;
|
413
|
+
once(event: "data", listener: (data: Buffer) => void): this;
|
414
|
+
once(event: "drain", listener: () => void): this;
|
415
|
+
once(event: "end", listener: () => void): this;
|
416
|
+
once(event: "error", listener: (err: Error) => void): this;
|
417
|
+
once(
|
418
|
+
event: "lookup",
|
419
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
420
|
+
): this;
|
421
|
+
once(event: "ready", listener: () => void): this;
|
422
|
+
once(event: "timeout", listener: () => void): this;
|
423
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
424
|
+
prependListener(event: "close", listener: (hadError: boolean) => void): this;
|
425
|
+
prependListener(event: "connect", listener: () => void): this;
|
426
|
+
prependListener(event: "data", listener: (data: Buffer) => void): this;
|
427
|
+
prependListener(event: "drain", listener: () => void): this;
|
428
|
+
prependListener(event: "end", listener: () => void): this;
|
429
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
430
|
+
prependListener(
|
431
|
+
event: "lookup",
|
432
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
433
|
+
): this;
|
434
|
+
prependListener(event: "ready", listener: () => void): this;
|
435
|
+
prependListener(event: "timeout", listener: () => void): this;
|
436
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
437
|
+
prependOnceListener(event: "close", listener: (hadError: boolean) => void): this;
|
438
|
+
prependOnceListener(event: "connect", listener: () => void): this;
|
439
|
+
prependOnceListener(event: "data", listener: (data: Buffer) => void): this;
|
440
|
+
prependOnceListener(event: "drain", listener: () => void): this;
|
441
|
+
prependOnceListener(event: "end", listener: () => void): this;
|
442
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
443
|
+
prependOnceListener(
|
444
|
+
event: "lookup",
|
445
|
+
listener: (err: Error, address: string, family: string | number, host: string) => void,
|
446
|
+
): this;
|
447
|
+
prependOnceListener(event: "ready", listener: () => void): this;
|
448
|
+
prependOnceListener(event: "timeout", listener: () => void): this;
|
449
|
+
}
|
450
|
+
interface ListenOptions extends Abortable {
|
451
|
+
port?: number | undefined;
|
452
|
+
host?: string | undefined;
|
453
|
+
backlog?: number | undefined;
|
454
|
+
path?: string | undefined;
|
455
|
+
exclusive?: boolean | undefined;
|
456
|
+
readableAll?: boolean | undefined;
|
457
|
+
writableAll?: boolean | undefined;
|
458
|
+
/**
|
459
|
+
* @default false
|
460
|
+
*/
|
461
|
+
ipv6Only?: boolean | undefined;
|
462
|
+
}
|
463
|
+
interface ServerOpts {
|
464
|
+
/**
|
465
|
+
* Indicates whether half-opened TCP connections are allowed.
|
466
|
+
* @default false
|
467
|
+
*/
|
468
|
+
allowHalfOpen?: boolean | undefined;
|
469
|
+
/**
|
470
|
+
* Indicates whether the socket should be paused on incoming connections.
|
471
|
+
* @default false
|
472
|
+
*/
|
473
|
+
pauseOnConnect?: boolean | undefined;
|
474
|
+
/**
|
475
|
+
* If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received.
|
476
|
+
* @default false
|
477
|
+
* @since v16.5.0
|
478
|
+
*/
|
479
|
+
noDelay?: boolean | undefined;
|
480
|
+
/**
|
481
|
+
* If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received,
|
482
|
+
* similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`.
|
483
|
+
* @default false
|
484
|
+
* @since v16.5.0
|
485
|
+
*/
|
486
|
+
keepAlive?: boolean | undefined;
|
487
|
+
/**
|
488
|
+
* If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket.
|
489
|
+
* @default 0
|
490
|
+
* @since v16.5.0
|
491
|
+
*/
|
492
|
+
keepAliveInitialDelay?: number | undefined;
|
493
|
+
}
|
494
|
+
interface DropArgument {
|
495
|
+
localAddress?: string;
|
496
|
+
localPort?: number;
|
497
|
+
localFamily?: string;
|
498
|
+
remoteAddress?: string;
|
499
|
+
remotePort?: number;
|
500
|
+
remoteFamily?: string;
|
501
|
+
}
|
502
|
+
/**
|
503
|
+
* This class is used to create a TCP or `IPC` server.
|
504
|
+
* @since v0.1.90
|
505
|
+
*/
|
506
|
+
class Server extends EventEmitter {
|
507
|
+
constructor(connectionListener?: (socket: Socket) => void);
|
508
|
+
constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void);
|
509
|
+
/**
|
510
|
+
* Start a server listening for connections. A `net.Server` can be a TCP or
|
511
|
+
* an `IPC` server depending on what it listens to.
|
512
|
+
*
|
513
|
+
* Possible signatures:
|
514
|
+
*
|
515
|
+
* * `server.listen(handle[, backlog][, callback])`
|
516
|
+
* * `server.listen(options[, callback])`
|
517
|
+
* * `server.listen(path[, backlog][, callback])` for `IPC` servers
|
518
|
+
* * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers
|
519
|
+
*
|
520
|
+
* 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'`
|
521
|
+
* event.
|
522
|
+
*
|
523
|
+
* All `listen()` methods can take a `backlog` parameter to specify the maximum
|
524
|
+
* length of the queue of pending connections. The actual length will be determined
|
525
|
+
* 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).
|
526
|
+
*
|
527
|
+
* All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for
|
528
|
+
* details).
|
529
|
+
*
|
530
|
+
* The `server.listen()` method can be called again if and only if there was an
|
531
|
+
* error during the first `server.listen()` call or `server.close()` has been
|
532
|
+
* called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown.
|
533
|
+
*
|
534
|
+
* One of the most common errors raised when listening is `EADDRINUSE`.
|
535
|
+
* This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry
|
536
|
+
* after a certain amount of time:
|
537
|
+
*
|
538
|
+
* ```js
|
539
|
+
* server.on('error', (e) => {
|
540
|
+
* if (e.code === 'EADDRINUSE') {
|
541
|
+
* console.error('Address in use, retrying...');
|
542
|
+
* setTimeout(() => {
|
543
|
+
* server.close();
|
544
|
+
* server.listen(PORT, HOST);
|
545
|
+
* }, 1000);
|
546
|
+
* }
|
547
|
+
* });
|
548
|
+
* ```
|
549
|
+
*/
|
550
|
+
listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
|
551
|
+
listen(port?: number, hostname?: string, listeningListener?: () => void): this;
|
552
|
+
listen(port?: number, backlog?: number, listeningListener?: () => void): this;
|
553
|
+
listen(port?: number, listeningListener?: () => void): this;
|
554
|
+
listen(path: string, backlog?: number, listeningListener?: () => void): this;
|
555
|
+
listen(path: string, listeningListener?: () => void): this;
|
556
|
+
listen(options: ListenOptions, listeningListener?: () => void): this;
|
557
|
+
listen(handle: any, backlog?: number, listeningListener?: () => void): this;
|
558
|
+
listen(handle: any, listeningListener?: () => void): this;
|
559
|
+
/**
|
560
|
+
* Stops the server from accepting new connections and keeps existing
|
561
|
+
* connections. This function is asynchronous, the server is finally closed
|
562
|
+
* when all connections are ended and the server emits a `'close'` event.
|
563
|
+
* The optional `callback` will be called once the `'close'` event occurs. Unlike
|
564
|
+
* that event, it will be called with an `Error` as its only argument if the server
|
565
|
+
* was not open when it was closed.
|
566
|
+
* @since v0.1.90
|
567
|
+
* @param callback Called when the server is closed.
|
568
|
+
*/
|
569
|
+
close(callback?: (err?: Error) => void): this;
|
570
|
+
/**
|
571
|
+
* Returns the bound `address`, the address `family` name, and `port` of the server
|
572
|
+
* as reported by the operating system if listening on an IP socket
|
573
|
+
* (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`.
|
574
|
+
*
|
575
|
+
* For a server listening on a pipe or Unix domain socket, the name is returned
|
576
|
+
* as a string.
|
577
|
+
*
|
578
|
+
* ```js
|
579
|
+
* const server = net.createServer((socket) => {
|
580
|
+
* socket.end('goodbye\n');
|
581
|
+
* }).on('error', (err) => {
|
582
|
+
* // Handle errors here.
|
583
|
+
* throw err;
|
584
|
+
* });
|
585
|
+
*
|
586
|
+
* // Grab an arbitrary unused port.
|
587
|
+
* server.listen(() => {
|
588
|
+
* console.log('opened server on', server.address());
|
589
|
+
* });
|
590
|
+
* ```
|
591
|
+
*
|
592
|
+
* `server.address()` returns `null` before the `'listening'` event has been
|
593
|
+
* emitted or after calling `server.close()`.
|
594
|
+
* @since v0.1.90
|
595
|
+
*/
|
596
|
+
address(): AddressInfo | string | null;
|
597
|
+
/**
|
598
|
+
* Asynchronously get the number of concurrent connections on the server. Works
|
599
|
+
* when sockets were sent to forks.
|
600
|
+
*
|
601
|
+
* Callback should take two arguments `err` and `count`.
|
602
|
+
* @since v0.9.7
|
603
|
+
*/
|
604
|
+
getConnections(cb: (error: Error | null, count: number) => void): void;
|
605
|
+
/**
|
606
|
+
* 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).
|
607
|
+
* If the server is `ref`ed calling `ref()` again will have no effect.
|
608
|
+
* @since v0.9.1
|
609
|
+
*/
|
610
|
+
ref(): this;
|
611
|
+
/**
|
612
|
+
* Calling `unref()` on a server will allow the program to exit if this is the only
|
613
|
+
* active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect.
|
614
|
+
* @since v0.9.1
|
615
|
+
*/
|
616
|
+
unref(): this;
|
617
|
+
/**
|
618
|
+
* Set this property to reject connections when the server's connection count gets
|
619
|
+
* high.
|
620
|
+
*
|
621
|
+
* It is not recommended to use this option once a socket has been sent to a child
|
622
|
+
* with `child_process.fork()`.
|
623
|
+
* @since v0.2.0
|
624
|
+
*/
|
625
|
+
maxConnections: number;
|
626
|
+
connections: number;
|
627
|
+
/**
|
628
|
+
* Indicates whether or not the server is listening for connections.
|
629
|
+
* @since v5.7.0
|
630
|
+
*/
|
631
|
+
listening: boolean;
|
632
|
+
/**
|
633
|
+
* events.EventEmitter
|
634
|
+
* 1. close
|
635
|
+
* 2. connection
|
636
|
+
* 3. error
|
637
|
+
* 4. listening
|
638
|
+
* 5. drop
|
639
|
+
*/
|
640
|
+
addListener(event: string, listener: (...args: any[]) => void): this;
|
641
|
+
addListener(event: "close", listener: () => void): this;
|
642
|
+
addListener(event: "connection", listener: (socket: Socket) => void): this;
|
643
|
+
addListener(event: "error", listener: (err: Error) => void): this;
|
644
|
+
addListener(event: "listening", listener: () => void): this;
|
645
|
+
addListener(event: "drop", listener: (data?: DropArgument) => void): this;
|
646
|
+
emit(event: string | symbol, ...args: any[]): boolean;
|
647
|
+
emit(event: "close"): boolean;
|
648
|
+
emit(event: "connection", socket: Socket): boolean;
|
649
|
+
emit(event: "error", err: Error): boolean;
|
650
|
+
emit(event: "listening"): boolean;
|
651
|
+
emit(event: "drop", data?: DropArgument): boolean;
|
652
|
+
on(event: string, listener: (...args: any[]) => void): this;
|
653
|
+
on(event: "close", listener: () => void): this;
|
654
|
+
on(event: "connection", listener: (socket: Socket) => void): this;
|
655
|
+
on(event: "error", listener: (err: Error) => void): this;
|
656
|
+
on(event: "listening", listener: () => void): this;
|
657
|
+
on(event: "drop", listener: (data?: DropArgument) => void): this;
|
658
|
+
once(event: string, listener: (...args: any[]) => void): this;
|
659
|
+
once(event: "close", listener: () => void): this;
|
660
|
+
once(event: "connection", listener: (socket: Socket) => void): this;
|
661
|
+
once(event: "error", listener: (err: Error) => void): this;
|
662
|
+
once(event: "listening", listener: () => void): this;
|
663
|
+
once(event: "drop", listener: (data?: DropArgument) => void): this;
|
664
|
+
prependListener(event: string, listener: (...args: any[]) => void): this;
|
665
|
+
prependListener(event: "close", listener: () => void): this;
|
666
|
+
prependListener(event: "connection", listener: (socket: Socket) => void): this;
|
667
|
+
prependListener(event: "error", listener: (err: Error) => void): this;
|
668
|
+
prependListener(event: "listening", listener: () => void): this;
|
669
|
+
prependListener(event: "drop", listener: (data?: DropArgument) => void): this;
|
670
|
+
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
|
671
|
+
prependOnceListener(event: "close", listener: () => void): this;
|
672
|
+
prependOnceListener(event: "connection", listener: (socket: Socket) => void): this;
|
673
|
+
prependOnceListener(event: "error", listener: (err: Error) => void): this;
|
674
|
+
prependOnceListener(event: "listening", listener: () => void): this;
|
675
|
+
prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this;
|
676
|
+
/**
|
677
|
+
* Calls {@link Server.close()} and returns a promise that fulfills when the server has closed.
|
678
|
+
* @since v20.5.0
|
679
|
+
*/
|
680
|
+
[Symbol.asyncDispose](): Promise<void>;
|
681
|
+
}
|
682
|
+
type IPVersion = "ipv4" | "ipv6";
|
683
|
+
/**
|
684
|
+
* The `BlockList` object can be used with some network APIs to specify rules for
|
685
|
+
* disabling inbound or outbound access to specific IP addresses, IP ranges, or
|
686
|
+
* IP subnets.
|
687
|
+
* @since v15.0.0, v14.18.0
|
688
|
+
*/
|
689
|
+
class BlockList {
|
690
|
+
/**
|
691
|
+
* Adds a rule to block the given IP address.
|
692
|
+
* @since v15.0.0, v14.18.0
|
693
|
+
* @param address An IPv4 or IPv6 address.
|
694
|
+
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
695
|
+
*/
|
696
|
+
addAddress(address: string, type?: IPVersion): void;
|
697
|
+
addAddress(address: SocketAddress): void;
|
698
|
+
/**
|
699
|
+
* Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive).
|
700
|
+
* @since v15.0.0, v14.18.0
|
701
|
+
* @param start The starting IPv4 or IPv6 address in the range.
|
702
|
+
* @param end The ending IPv4 or IPv6 address in the range.
|
703
|
+
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
704
|
+
*/
|
705
|
+
addRange(start: string, end: string, type?: IPVersion): void;
|
706
|
+
addRange(start: SocketAddress, end: SocketAddress): void;
|
707
|
+
/**
|
708
|
+
* Adds a rule to block a range of IP addresses specified as a subnet mask.
|
709
|
+
* @since v15.0.0, v14.18.0
|
710
|
+
* @param net The network IPv4 or IPv6 address.
|
711
|
+
* @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`.
|
712
|
+
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
713
|
+
*/
|
714
|
+
addSubnet(net: SocketAddress, prefix: number): void;
|
715
|
+
addSubnet(net: string, prefix: number, type?: IPVersion): void;
|
716
|
+
/**
|
717
|
+
* Returns `true` if the given IP address matches any of the rules added to the`BlockList`.
|
718
|
+
*
|
719
|
+
* ```js
|
720
|
+
* const blockList = new net.BlockList();
|
721
|
+
* blockList.addAddress('123.123.123.123');
|
722
|
+
* blockList.addRange('10.0.0.1', '10.0.0.10');
|
723
|
+
* blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6');
|
724
|
+
*
|
725
|
+
* console.log(blockList.check('123.123.123.123')); // Prints: true
|
726
|
+
* console.log(blockList.check('10.0.0.3')); // Prints: true
|
727
|
+
* console.log(blockList.check('222.111.111.222')); // Prints: false
|
728
|
+
*
|
729
|
+
* // IPv6 notation for IPv4 addresses works:
|
730
|
+
* console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true
|
731
|
+
* console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true
|
732
|
+
* ```
|
733
|
+
* @since v15.0.0, v14.18.0
|
734
|
+
* @param address The IP address to check
|
735
|
+
* @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`.
|
736
|
+
*/
|
737
|
+
check(address: SocketAddress): boolean;
|
738
|
+
check(address: string, type?: IPVersion): boolean;
|
739
|
+
}
|
740
|
+
interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts {
|
741
|
+
timeout?: number | undefined;
|
742
|
+
}
|
743
|
+
interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts {
|
744
|
+
timeout?: number | undefined;
|
745
|
+
}
|
746
|
+
type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts;
|
747
|
+
/**
|
748
|
+
* Creates a new TCP or `IPC` server.
|
749
|
+
*
|
750
|
+
* If `allowHalfOpen` is set to `true`, when the other end of the socket
|
751
|
+
* signals the end of transmission, the server will only send back the end of
|
752
|
+
* transmission when `socket.end()` is explicitly called. For example, in the
|
753
|
+
* context of TCP, when a FIN packed is received, a FIN packed is sent
|
754
|
+
* back only when `socket.end()` is explicitly called. Until then the
|
755
|
+
* 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.
|
756
|
+
*
|
757
|
+
* If `pauseOnConnect` is set to `true`, then the socket associated with each
|
758
|
+
* incoming connection will be paused, and no data will be read from its handle.
|
759
|
+
* This allows connections to be passed between processes without any data being
|
760
|
+
* read by the original process. To begin reading data from a paused socket, call `socket.resume()`.
|
761
|
+
*
|
762
|
+
* The server can be a TCP server or an `IPC` server, depending on what it `listen()` to.
|
763
|
+
*
|
764
|
+
* Here is an example of a TCP echo server which listens for connections
|
765
|
+
* on port 8124:
|
766
|
+
*
|
767
|
+
* ```js
|
768
|
+
* const net = require('node:net');
|
769
|
+
* const server = net.createServer((c) => {
|
770
|
+
* // 'connection' listener.
|
771
|
+
* console.log('client connected');
|
772
|
+
* c.on('end', () => {
|
773
|
+
* console.log('client disconnected');
|
774
|
+
* });
|
775
|
+
* c.write('hello\r\n');
|
776
|
+
* c.pipe(c);
|
777
|
+
* });
|
778
|
+
* server.on('error', (err) => {
|
779
|
+
* throw err;
|
780
|
+
* });
|
781
|
+
* server.listen(8124, () => {
|
782
|
+
* console.log('server bound');
|
783
|
+
* });
|
784
|
+
* ```
|
785
|
+
*
|
786
|
+
* Test this by using `telnet`:
|
787
|
+
*
|
788
|
+
* ```bash
|
789
|
+
* telnet localhost 8124
|
790
|
+
* ```
|
791
|
+
*
|
792
|
+
* To listen on the socket `/tmp/echo.sock`:
|
793
|
+
*
|
794
|
+
* ```js
|
795
|
+
* server.listen('/tmp/echo.sock', () => {
|
796
|
+
* console.log('server bound');
|
797
|
+
* });
|
798
|
+
* ```
|
799
|
+
*
|
800
|
+
* Use `nc` to connect to a Unix domain socket server:
|
801
|
+
*
|
802
|
+
* ```bash
|
803
|
+
* nc -U /tmp/echo.sock
|
804
|
+
* ```
|
805
|
+
* @since v0.5.0
|
806
|
+
* @param connectionListener Automatically set as a listener for the {@link 'connection'} event.
|
807
|
+
*/
|
808
|
+
function createServer(connectionListener?: (socket: Socket) => void): Server;
|
809
|
+
function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server;
|
810
|
+
/**
|
811
|
+
* Aliases to {@link createConnection}.
|
812
|
+
*
|
813
|
+
* Possible signatures:
|
814
|
+
*
|
815
|
+
* * {@link connect}
|
816
|
+
* * {@link connect} for `IPC` connections.
|
817
|
+
* * {@link connect} for TCP connections.
|
818
|
+
*/
|
819
|
+
function connect(options: NetConnectOpts, connectionListener?: () => void): Socket;
|
820
|
+
function connect(port: number, host?: string, connectionListener?: () => void): Socket;
|
821
|
+
function connect(path: string, connectionListener?: () => void): Socket;
|
822
|
+
/**
|
823
|
+
* A factory function, which creates a new {@link Socket},
|
824
|
+
* immediately initiates connection with `socket.connect()`,
|
825
|
+
* then returns the `net.Socket` that starts the connection.
|
826
|
+
*
|
827
|
+
* When the connection is established, a `'connect'` event will be emitted
|
828
|
+
* on the returned socket. The last parameter `connectListener`, if supplied,
|
829
|
+
* will be added as a listener for the `'connect'` event **once**.
|
830
|
+
*
|
831
|
+
* Possible signatures:
|
832
|
+
*
|
833
|
+
* * {@link createConnection}
|
834
|
+
* * {@link createConnection} for `IPC` connections.
|
835
|
+
* * {@link createConnection} for TCP connections.
|
836
|
+
*
|
837
|
+
* The {@link connect} function is an alias to this function.
|
838
|
+
*/
|
839
|
+
function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket;
|
840
|
+
function createConnection(port: number, host?: string, connectionListener?: () => void): Socket;
|
841
|
+
function createConnection(path: string, connectionListener?: () => void): Socket;
|
842
|
+
/**
|
843
|
+
* Gets the current default value of the `autoSelectFamily` option of `socket.connect(options)`.
|
844
|
+
* The initial default value is `true`, unless the command line option`--no-network-family-autoselection` is provided.
|
845
|
+
* @since v19.4.0
|
846
|
+
*/
|
847
|
+
function getDefaultAutoSelectFamily(): boolean;
|
848
|
+
/**
|
849
|
+
* Sets the default value of the `autoSelectFamily` option of `socket.connect(options)`.
|
850
|
+
* @since v19.4.0
|
851
|
+
*/
|
852
|
+
function setDefaultAutoSelectFamily(value: boolean): void;
|
853
|
+
/**
|
854
|
+
* Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
|
855
|
+
* The initial default value is `250`.
|
856
|
+
* @since v19.8.0
|
857
|
+
*/
|
858
|
+
function getDefaultAutoSelectFamilyAttemptTimeout(): number;
|
859
|
+
/**
|
860
|
+
* Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`.
|
861
|
+
* @since v19.8.0
|
862
|
+
*/
|
863
|
+
function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void;
|
864
|
+
/**
|
865
|
+
* Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4
|
866
|
+
* address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`.
|
867
|
+
*
|
868
|
+
* ```js
|
869
|
+
* net.isIP('::1'); // returns 6
|
870
|
+
* net.isIP('127.0.0.1'); // returns 4
|
871
|
+
* net.isIP('127.000.000.001'); // returns 0
|
872
|
+
* net.isIP('127.0.0.1/24'); // returns 0
|
873
|
+
* net.isIP('fhqwhgads'); // returns 0
|
874
|
+
* ```
|
875
|
+
* @since v0.3.0
|
876
|
+
*/
|
877
|
+
function isIP(input: string): number;
|
878
|
+
/**
|
879
|
+
* Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no
|
880
|
+
* leading zeroes. Otherwise, returns `false`.
|
881
|
+
*
|
882
|
+
* ```js
|
883
|
+
* net.isIPv4('127.0.0.1'); // returns true
|
884
|
+
* net.isIPv4('127.000.000.001'); // returns false
|
885
|
+
* net.isIPv4('127.0.0.1/24'); // returns false
|
886
|
+
* net.isIPv4('fhqwhgads'); // returns false
|
887
|
+
* ```
|
888
|
+
* @since v0.3.0
|
889
|
+
*/
|
890
|
+
function isIPv4(input: string): boolean;
|
891
|
+
/**
|
892
|
+
* Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`.
|
893
|
+
*
|
894
|
+
* ```js
|
895
|
+
* net.isIPv6('::1'); // returns true
|
896
|
+
* net.isIPv6('fhqwhgads'); // returns false
|
897
|
+
* ```
|
898
|
+
* @since v0.3.0
|
899
|
+
*/
|
900
|
+
function isIPv6(input: string): boolean;
|
901
|
+
interface SocketAddressInitOptions {
|
902
|
+
/**
|
903
|
+
* The network address as either an IPv4 or IPv6 string.
|
904
|
+
* @default 127.0.0.1
|
905
|
+
*/
|
906
|
+
address?: string | undefined;
|
907
|
+
/**
|
908
|
+
* @default `'ipv4'`
|
909
|
+
*/
|
910
|
+
family?: IPVersion | undefined;
|
911
|
+
/**
|
912
|
+
* An IPv6 flow-label used only if `family` is `'ipv6'`.
|
913
|
+
* @default 0
|
914
|
+
*/
|
915
|
+
flowlabel?: number | undefined;
|
916
|
+
/**
|
917
|
+
* An IP port.
|
918
|
+
* @default 0
|
919
|
+
*/
|
920
|
+
port?: number | undefined;
|
921
|
+
}
|
922
|
+
/**
|
923
|
+
* @since v15.14.0, v14.18.0
|
924
|
+
*/
|
925
|
+
class SocketAddress {
|
926
|
+
constructor(options: SocketAddressInitOptions);
|
927
|
+
/**
|
928
|
+
* Either \`'ipv4'\` or \`'ipv6'\`.
|
929
|
+
* @since v15.14.0, v14.18.0
|
930
|
+
*/
|
931
|
+
readonly address: string;
|
932
|
+
/**
|
933
|
+
* Either \`'ipv4'\` or \`'ipv6'\`.
|
934
|
+
* @since v15.14.0, v14.18.0
|
935
|
+
*/
|
936
|
+
readonly family: IPVersion;
|
937
|
+
/**
|
938
|
+
* @since v15.14.0, v14.18.0
|
939
|
+
*/
|
940
|
+
readonly port: number;
|
941
|
+
/**
|
942
|
+
* @since v15.14.0, v14.18.0
|
943
|
+
*/
|
944
|
+
readonly flowlabel: number;
|
945
|
+
}
|
946
|
+
}
|
947
|
+
declare module "node:net" {
|
948
|
+
export * from "net";
|
949
|
+
}
|