@ykdz/template 0.0.37 → 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/dist/application.d.ts +1 -52
  2. package/dist/application.js +0 -81
  3. package/dist/cli.js +14 -28
  4. package/dist/input-schemas.d.ts +30 -0
  5. package/dist/input-schemas.js +75 -0
  6. package/dist/main.d.ts +3 -14
  7. package/dist/main.js +496 -378
  8. package/dist/result-schemas.d.ts +222 -0
  9. package/dist/result-schemas.js +74 -0
  10. package/dist/standard-schema.d.ts +3 -0
  11. package/dist/standard-schema.js +29 -0
  12. package/node_modules/@standard-schema/spec/LICENSE +21 -0
  13. package/node_modules/@standard-schema/spec/README.md +198 -0
  14. package/node_modules/@standard-schema/spec/dist/index.cjs +18 -0
  15. package/node_modules/@standard-schema/spec/dist/index.d.cts +119 -0
  16. package/node_modules/@standard-schema/spec/dist/index.d.ts +119 -0
  17. package/node_modules/@standard-schema/spec/dist/index.js +0 -0
  18. package/node_modules/@standard-schema/spec/package.json +52 -0
  19. package/node_modules/@types/node/LICENSE +21 -0
  20. package/node_modules/@types/node/README.md +15 -0
  21. package/node_modules/@types/node/assert/strict.d.ts +111 -0
  22. package/node_modules/@types/node/assert.d.ts +1115 -0
  23. package/node_modules/@types/node/async_hooks.d.ts +619 -0
  24. package/node_modules/@types/node/buffer.buffer.d.ts +477 -0
  25. package/node_modules/@types/node/buffer.d.ts +1941 -0
  26. package/node_modules/@types/node/child_process.d.ts +1480 -0
  27. package/node_modules/@types/node/cluster.d.ts +578 -0
  28. package/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  29. package/node_modules/@types/node/console.d.ts +453 -0
  30. package/node_modules/@types/node/constants.d.ts +21 -0
  31. package/node_modules/@types/node/crypto.d.ts +5484 -0
  32. package/node_modules/@types/node/dgram.d.ts +715 -0
  33. package/node_modules/@types/node/diagnostics_channel.d.ts +576 -0
  34. package/node_modules/@types/node/dns/promises.d.ts +503 -0
  35. package/node_modules/@types/node/dns.d.ts +923 -0
  36. package/node_modules/@types/node/domain.d.ts +166 -0
  37. package/node_modules/@types/node/events.d.ts +967 -0
  38. package/node_modules/@types/node/fs/promises.d.ts +1354 -0
  39. package/node_modules/@types/node/fs.d.ts +4777 -0
  40. package/node_modules/@types/node/globals.d.ts +170 -0
  41. package/node_modules/@types/node/globals.typedarray.d.ts +41 -0
  42. package/node_modules/@types/node/http.d.ts +2246 -0
  43. package/node_modules/@types/node/http2.d.ts +2882 -0
  44. package/node_modules/@types/node/https.d.ts +585 -0
  45. package/node_modules/@types/node/index.d.ts +101 -0
  46. package/node_modules/@types/node/inspector.d.ts +323 -0
  47. package/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  48. package/node_modules/@types/node/module.d.ts +844 -0
  49. package/node_modules/@types/node/net.d.ts +1197 -0
  50. package/node_modules/@types/node/os.d.ts +507 -0
  51. package/node_modules/@types/node/package.json +140 -0
  52. package/node_modules/@types/node/path.d.ts +200 -0
  53. package/node_modules/@types/node/perf_hooks.d.ts +1054 -0
  54. package/node_modules/@types/node/process.d.ts +2101 -0
  55. package/node_modules/@types/node/punycode.d.ts +117 -0
  56. package/node_modules/@types/node/querystring.d.ts +152 -0
  57. package/node_modules/@types/node/readline/promises.d.ts +161 -0
  58. package/node_modules/@types/node/readline.d.ts +600 -0
  59. package/node_modules/@types/node/repl.d.ts +438 -0
  60. package/node_modules/@types/node/sea.d.ts +162 -0
  61. package/node_modules/@types/node/sqlite.d.ts +1182 -0
  62. package/node_modules/@types/node/stream/consumers.d.ts +45 -0
  63. package/node_modules/@types/node/stream/promises.d.ts +90 -0
  64. package/node_modules/@types/node/stream/web.d.ts +596 -0
  65. package/node_modules/@types/node/stream.d.ts +1707 -0
  66. package/node_modules/@types/node/string_decoder.d.ts +67 -0
  67. package/node_modules/@types/node/test.d.ts +2656 -0
  68. package/node_modules/@types/node/timers/promises.d.ts +108 -0
  69. package/node_modules/@types/node/timers.d.ts +285 -0
  70. package/node_modules/@types/node/tls.d.ts +1314 -0
  71. package/node_modules/@types/node/trace_events.d.ts +197 -0
  72. package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +473 -0
  73. package/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  74. package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  75. package/node_modules/@types/node/ts5.6/index.d.ts +103 -0
  76. package/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  77. package/node_modules/@types/node/ts5.7/index.d.ts +103 -0
  78. package/node_modules/@types/node/tty.d.ts +209 -0
  79. package/node_modules/@types/node/url.d.ts +1103 -0
  80. package/node_modules/@types/node/util.d.ts +2376 -0
  81. package/node_modules/@types/node/v8.d.ts +1010 -0
  82. package/node_modules/@types/node/vm.d.ts +1160 -0
  83. package/node_modules/@types/node/wasi.d.ts +202 -0
  84. package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  85. package/node_modules/@types/node/web-globals/crypto.d.ts +32 -0
  86. package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  87. package/node_modules/@types/node/web-globals/events.d.ts +97 -0
  88. package/node_modules/@types/node/web-globals/fetch.d.ts +62 -0
  89. package/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  90. package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  91. package/node_modules/@types/node/web-globals/streams.d.ts +22 -0
  92. package/node_modules/@types/node/worker_threads.d.ts +894 -0
  93. package/node_modules/@types/node/zlib.d.ts +768 -0
  94. package/node_modules/@valibot/to-json-schema/LICENSE.md +9 -0
  95. package/node_modules/@valibot/to-json-schema/README.md +475 -0
  96. package/node_modules/@valibot/to-json-schema/dist/index.cjs +800 -0
  97. package/node_modules/@valibot/to-json-schema/dist/index.d.cts +991 -0
  98. package/node_modules/@valibot/to-json-schema/dist/index.d.mts +991 -0
  99. package/node_modules/@valibot/to-json-schema/dist/index.min.cjs +1 -0
  100. package/node_modules/@valibot/to-json-schema/dist/index.min.mjs +1 -0
  101. package/node_modules/@valibot/to-json-schema/dist/index.mjs +795 -0
  102. package/node_modules/@valibot/to-json-schema/package.json +75 -0
  103. package/node_modules/@ykdz/cli-contract/LICENSE +21 -0
  104. package/node_modules/@ykdz/cli-contract/dist/atomic-variant-compiler.d.ts +17 -0
  105. package/node_modules/@ykdz/cli-contract/dist/atomic-variant-compiler.js +55 -0
  106. package/node_modules/@ykdz/cli-contract/dist/cli-contract.d.ts +1164 -0
  107. package/node_modules/@ykdz/cli-contract/dist/cli-contract.js +1408 -0
  108. package/node_modules/@ykdz/cli-contract/dist/cli-execution.d.ts +54 -0
  109. package/node_modules/@ykdz/cli-contract/dist/cli-execution.js +708 -0
  110. package/node_modules/@ykdz/cli-contract/dist/cli-invocation.d.ts +174 -0
  111. package/node_modules/@ykdz/cli-contract/dist/cli-invocation.js +524 -0
  112. package/node_modules/@ykdz/cli-contract/dist/cli-write-error.d.ts +10 -0
  113. package/node_modules/@ykdz/cli-contract/dist/cli-write-error.js +14 -0
  114. package/node_modules/@ykdz/cli-contract/dist/contract-definition-error.d.ts +260 -0
  115. package/node_modules/@ykdz/cli-contract/dist/contract-definition-error.js +130 -0
  116. package/node_modules/@ykdz/cli-contract/dist/contract-execution-error.d.ts +63 -0
  117. package/node_modules/@ykdz/cli-contract/dist/contract-execution-error.js +17 -0
  118. package/node_modules/@ykdz/cli-contract/dist/contract-schema-compiler.d.ts +6 -0
  119. package/node_modules/@ykdz/cli-contract/dist/contract-schema-compiler.js +532 -0
  120. package/node_modules/@ykdz/cli-contract/dist/contract-schema.d.ts +14 -0
  121. package/node_modules/@ykdz/cli-contract/dist/contract-schema.js +1 -0
  122. package/node_modules/@ykdz/cli-contract/dist/description.d.ts +2 -0
  123. package/node_modules/@ykdz/cli-contract/dist/description.js +13 -0
  124. package/node_modules/@ykdz/cli-contract/dist/index.d.ts +8 -0
  125. package/node_modules/@ykdz/cli-contract/dist/index.js +7 -0
  126. package/node_modules/@ykdz/cli-contract/dist/json-value.d.ts +4 -0
  127. package/node_modules/@ykdz/cli-contract/dist/json-value.js +64 -0
  128. package/node_modules/@ykdz/cli-contract/dist/node.d.ts +21 -0
  129. package/node_modules/@ykdz/cli-contract/dist/node.js +109 -0
  130. package/node_modules/@ykdz/cli-contract/dist/outcome-fact.d.ts +162 -0
  131. package/node_modules/@ykdz/cli-contract/dist/outcome-fact.js +113 -0
  132. package/node_modules/@ykdz/cli-contract/dist/outcome-wire.d.ts +53 -0
  133. package/node_modules/@ykdz/cli-contract/dist/outcome-wire.js +189 -0
  134. package/node_modules/@ykdz/cli-contract/dist/stream-variant-compiler.d.ts +16 -0
  135. package/node_modules/@ykdz/cli-contract/dist/stream-variant-compiler.js +45 -0
  136. package/node_modules/@ykdz/cli-contract/package.json +69 -0
  137. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.d.ts +20 -0
  138. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +27 -28
  139. package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.d.ts +19 -0
  140. package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.js +1 -1
  141. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.d.ts +2 -1
  142. package/node_modules/@ykdz/template-builtin-presets/dist/src/index.js +2 -1
  143. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-cli/definition.js +9 -5
  144. package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.js +0 -4
  145. package/node_modules/@ykdz/template-builtin-presets/package.json +2 -1
  146. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/AGENTS.md.template +10 -4
  147. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/devcontainer.json +3 -0
  148. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/artifact.ts +128 -59
  149. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/handoff.ts +80 -8
  150. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/readiness.ts +7 -3
  151. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/cli.ts +9 -19
  152. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/main.ts +144 -60
  153. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/standard-schema.ts +37 -0
  154. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/e2e/journeys/lookup.journey.ts +71 -0
  155. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/integration/command.test.ts +118 -59
  156. package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +0 -1
  157. package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +2 -1
  158. package/node_modules/@ykdz/template-core/dist/project-blueprint.d.ts +15 -0
  159. package/node_modules/@ykdz/template-core/dist/project-blueprint.js +1 -1
  160. package/node_modules/@ykdz/template-core/dist/project-github.d.ts +1 -1
  161. package/node_modules/undici-types/LICENSE +21 -0
  162. package/node_modules/undici-types/README.md +6 -0
  163. package/node_modules/undici-types/agent.d.ts +32 -0
  164. package/node_modules/undici-types/api.d.ts +43 -0
  165. package/node_modules/undici-types/balanced-pool.d.ts +30 -0
  166. package/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  167. package/node_modules/undici-types/cache.d.ts +36 -0
  168. package/node_modules/undici-types/client-stats.d.ts +15 -0
  169. package/node_modules/undici-types/client.d.ts +123 -0
  170. package/node_modules/undici-types/connector.d.ts +36 -0
  171. package/node_modules/undici-types/content-type.d.ts +21 -0
  172. package/node_modules/undici-types/cookies.d.ts +30 -0
  173. package/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  174. package/node_modules/undici-types/dispatcher.d.ts +279 -0
  175. package/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  176. package/node_modules/undici-types/errors.d.ts +177 -0
  177. package/node_modules/undici-types/eventsource.d.ts +66 -0
  178. package/node_modules/undici-types/fetch.d.ts +211 -0
  179. package/node_modules/undici-types/formdata.d.ts +108 -0
  180. package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  181. package/node_modules/undici-types/global-origin.d.ts +7 -0
  182. package/node_modules/undici-types/h2c-client.d.ts +73 -0
  183. package/node_modules/undici-types/handlers.d.ts +15 -0
  184. package/node_modules/undici-types/header.d.ts +160 -0
  185. package/node_modules/undici-types/index.d.ts +91 -0
  186. package/node_modules/undici-types/interceptors.d.ts +80 -0
  187. package/node_modules/undici-types/mock-agent.d.ts +68 -0
  188. package/node_modules/undici-types/mock-call-history.d.ts +111 -0
  189. package/node_modules/undici-types/mock-client.d.ts +27 -0
  190. package/node_modules/undici-types/mock-errors.d.ts +12 -0
  191. package/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  192. package/node_modules/undici-types/mock-pool.d.ts +27 -0
  193. package/node_modules/undici-types/package.json +55 -0
  194. package/node_modules/undici-types/patch.d.ts +29 -0
  195. package/node_modules/undici-types/pool-stats.d.ts +19 -0
  196. package/node_modules/undici-types/pool.d.ts +41 -0
  197. package/node_modules/undici-types/proxy-agent.d.ts +29 -0
  198. package/node_modules/undici-types/readable.d.ts +68 -0
  199. package/node_modules/undici-types/retry-agent.d.ts +8 -0
  200. package/node_modules/undici-types/retry-handler.d.ts +125 -0
  201. package/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  202. package/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  203. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  204. package/node_modules/undici-types/util.d.ts +18 -0
  205. package/node_modules/undici-types/utility.d.ts +7 -0
  206. package/node_modules/undici-types/webidl.d.ts +347 -0
  207. package/node_modules/undici-types/websocket.d.ts +188 -0
  208. package/package.json +5 -3
  209. package/dist/command-result.d.ts +0 -9
  210. package/dist/command-result.js +0 -231
  211. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/e2e/journeys/greet.journey.ts +0 -46
  212. package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/unit/greet.test.ts +0 -15
  213. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/devcontainer/docker-client.Dockerfile +0 -3
  214. package/node_modules/commander/LICENSE +0 -22
  215. package/node_modules/commander/Readme.md +0 -1172
  216. package/node_modules/commander/index.js +0 -21
  217. package/node_modules/commander/lib/argument.js +0 -147
  218. package/node_modules/commander/lib/command.js +0 -2790
  219. package/node_modules/commander/lib/error.js +0 -36
  220. package/node_modules/commander/lib/help.js +0 -731
  221. package/node_modules/commander/lib/option.js +0 -377
  222. package/node_modules/commander/lib/suggestSimilar.js +0 -99
  223. package/node_modules/commander/package-support.json +0 -19
  224. package/node_modules/commander/package.json +0 -64
  225. package/node_modules/commander/typings/index.d.ts +0 -1113
@@ -0,0 +1,715 @@
1
+ /**
2
+ * The `node:dgram` module provides an implementation of UDP datagram sockets.
3
+ *
4
+ * ```js
5
+ * import dgram from 'node:dgram';
6
+ *
7
+ * const server = dgram.createSocket('udp4');
8
+ *
9
+ * server.on('error', (err) => {
10
+ * console.error(`server error:\n${err.stack}`);
11
+ * server.close();
12
+ * });
13
+ *
14
+ * server.on('message', (msg, rinfo) => {
15
+ * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
16
+ * });
17
+ *
18
+ * server.on('listening', () => {
19
+ * const address = server.address();
20
+ * console.log(`server listening ${address.address}:${address.port}`);
21
+ * });
22
+ *
23
+ * server.bind(41234);
24
+ * // Prints: server listening 0.0.0.0:41234
25
+ * ```
26
+ * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/dgram.js)
27
+ */
28
+ declare module "dgram" {
29
+ import { NonSharedBuffer } from "node:buffer";
30
+ import { AddressInfo, BlockList } from "node:net";
31
+ import * as dns from "node:dns";
32
+ import { Abortable, EventEmitter } from "node:events";
33
+ interface RemoteInfo {
34
+ address: string;
35
+ family: "IPv4" | "IPv6";
36
+ port: number;
37
+ size: number;
38
+ }
39
+ interface BindOptions {
40
+ port?: number | undefined;
41
+ address?: string | undefined;
42
+ exclusive?: boolean | undefined;
43
+ fd?: number | undefined;
44
+ }
45
+ interface BindSyncOptions {
46
+ port?: number | undefined;
47
+ address?: string | undefined;
48
+ }
49
+ type SocketType = "udp4" | "udp6";
50
+ interface SocketOptions extends Abortable {
51
+ type: SocketType;
52
+ reuseAddr?: boolean | undefined;
53
+ reusePort?: boolean | undefined;
54
+ /**
55
+ * @default false
56
+ */
57
+ ipv6Only?: boolean | undefined;
58
+ recvBufferSize?: number | undefined;
59
+ sendBufferSize?: number | undefined;
60
+ lookup?:
61
+ | ((
62
+ hostname: string,
63
+ options: dns.LookupOneOptions,
64
+ callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void,
65
+ ) => void)
66
+ | undefined;
67
+ receiveBlockList?: BlockList | undefined;
68
+ sendBlockList?: BlockList | undefined;
69
+ }
70
+ /**
71
+ * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram
72
+ * messages. When `address` and `port` are not passed to `socket.bind()` the
73
+ * method will bind the socket to the "all interfaces" address on a random port
74
+ * (it does the right thing for both `udp4` and `udp6` sockets). The bound address
75
+ * and port can be retrieved using `socket.address().address` and `socket.address().port`.
76
+ *
77
+ * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.close()` on the socket:
78
+ *
79
+ * ```js
80
+ * const controller = new AbortController();
81
+ * const { signal } = controller;
82
+ * const server = dgram.createSocket({ type: 'udp4', signal });
83
+ * server.on('message', (msg, rinfo) => {
84
+ * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
85
+ * });
86
+ * // Later, when you want to close the server.
87
+ * controller.abort();
88
+ * ```
89
+ * @since v0.11.13
90
+ * @param options Available options are:
91
+ * @param callback Attached as a listener for `'message'` events. Optional.
92
+ */
93
+ function createSocket(type: SocketType, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
94
+ function createSocket(options: SocketOptions, callback?: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): Socket;
95
+ /**
96
+ * Encapsulates the datagram functionality.
97
+ *
98
+ * New instances of `dgram.Socket` are created using {@link createSocket}.
99
+ * The `new` keyword is not to be used to create `dgram.Socket` instances.
100
+ * @since v0.1.99
101
+ */
102
+ class Socket extends EventEmitter {
103
+ /**
104
+ * Tells the kernel to join a multicast group at the given `multicastAddress` and `multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the `multicastInterface` argument is not
105
+ * specified, the operating system will choose
106
+ * one interface and will add membership to it. To add membership to every
107
+ * available interface, call `addMembership` multiple times, once per interface.
108
+ *
109
+ * When called on an unbound socket, this method will implicitly bind to a random
110
+ * port, listening on all interfaces.
111
+ *
112
+ * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur:
113
+ *
114
+ * ```js
115
+ * import cluster from 'node:cluster';
116
+ * import dgram from 'node:dgram';
117
+ *
118
+ * if (cluster.isPrimary) {
119
+ * cluster.fork(); // Works ok.
120
+ * cluster.fork(); // Fails with EADDRINUSE.
121
+ * } else {
122
+ * const s = dgram.createSocket('udp4');
123
+ * s.bind(1234, () => {
124
+ * s.addMembership('224.0.0.114');
125
+ * });
126
+ * }
127
+ * ```
128
+ * @since v0.6.9
129
+ */
130
+ addMembership(multicastAddress: string, multicastInterface?: string): void;
131
+ /**
132
+ * Returns an object containing the address information for a socket.
133
+ * For UDP sockets, this object will contain `address`, `family`, and `port` properties.
134
+ *
135
+ * This method throws `EBADF` if called on an unbound socket.
136
+ * @since v0.1.99
137
+ */
138
+ address(): AddressInfo;
139
+ /**
140
+ * For UDP sockets, causes the `dgram.Socket` to listen for datagram
141
+ * messages on a named `port` and optional `address`. If `port` is not
142
+ * specified or is `0`, the operating system will attempt to bind to a
143
+ * random port. If `address` is not specified, the operating system will
144
+ * attempt to listen on all addresses. Once binding is complete, a
145
+ * `'listening'` event is emitted and the optional `callback` function is
146
+ * called.
147
+ *
148
+ * Specifying both a `'listening'` event listener and passing a
149
+ * `callback` to the `socket.bind()` method is not harmful but not very
150
+ * useful.
151
+ *
152
+ * A bound datagram socket keeps the Node.js process running to receive
153
+ * datagram messages.
154
+ *
155
+ * If binding fails, an `'error'` event is generated. In rare case (e.g.
156
+ * attempting to bind with a closed socket), an `Error` may be thrown.
157
+ *
158
+ * Example of a UDP server listening on port 41234:
159
+ *
160
+ * ```js
161
+ * import dgram from 'node:dgram';
162
+ *
163
+ * const server = dgram.createSocket('udp4');
164
+ *
165
+ * server.on('error', (err) => {
166
+ * console.error(`server error:\n${err.stack}`);
167
+ * server.close();
168
+ * });
169
+ *
170
+ * server.on('message', (msg, rinfo) => {
171
+ * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
172
+ * });
173
+ *
174
+ * server.on('listening', () => {
175
+ * const address = server.address();
176
+ * console.log(`server listening ${address.address}:${address.port}`);
177
+ * });
178
+ *
179
+ * server.bind(41234);
180
+ * // Prints: server listening 0.0.0.0:41234
181
+ * ```
182
+ * @since v0.1.99
183
+ * @param callback with no parameters. Called when binding is complete.
184
+ */
185
+ bind(port?: number, address?: string, callback?: () => void): this;
186
+ bind(port: number, callback: () => void): this;
187
+ bind(callback: () => void): this;
188
+ /**
189
+ * For UDP sockets, causes the `dgram.Socket` to listen for datagram
190
+ * messages on a named `port` and optional `address` that are passed as
191
+ * properties of an `options` object passed as the first argument. If
192
+ * `port` is not specified or is `0`, the operating system will attempt
193
+ * to bind to a random port. If `address` is not specified, the operating
194
+ * system will attempt to listen on all addresses. Once binding is
195
+ * complete, a `'listening'` event is emitted and the optional `callback`
196
+ * function is called.
197
+ *
198
+ * The `options` object may contain a `fd` property. When a `fd` greater
199
+ * than `0` is set, it will wrap around an existing socket with the given
200
+ * file descriptor. In this case, the properties of `port` and `address`
201
+ * will be ignored.
202
+ *
203
+ * Specifying both a `'listening'` event listener and passing a
204
+ * `callback` to the `socket.bind()` method is not harmful but not very
205
+ * useful.
206
+ *
207
+ * The `options` object may contain an additional `exclusive` property that is
208
+ * used when using `dgram.Socket` objects with the [`cluster`](https://nodejs.org/docs/latest-v24.x/api/cluster.html) module. When
209
+ * `exclusive` is set to `false` (the default), cluster workers will use the same
210
+ * underlying socket handle allowing connection handling duties to be shared.
211
+ * When `exclusive` is `true`, however, the handle is not shared and attempted
212
+ * port sharing results in an error. Creating a `dgram.Socket` with the `reusePort`
213
+ * option set to `true` causes `exclusive` to always be `true` when `socket.bind()`
214
+ * is called.
215
+ *
216
+ * A bound datagram socket keeps the Node.js process running to receive
217
+ * datagram messages.
218
+ *
219
+ * If binding fails, an `'error'` event is generated. In rare case (e.g.
220
+ * attempting to bind with a closed socket), an `Error` may be thrown.
221
+ *
222
+ * An example socket listening on an exclusive port is shown below.
223
+ *
224
+ * ```js
225
+ * socket.bind({
226
+ * address: 'localhost',
227
+ * port: 8000,
228
+ * exclusive: true,
229
+ * });
230
+ * ```
231
+ * @since v0.11.14
232
+ * @param options Required. Supports the following properties:
233
+ */
234
+ bind(options: BindOptions, callback?: () => void): this;
235
+ /**
236
+ * The synchronous counterpart of `socket.bind()`. `bind(2)` is a local,
237
+ * non-blocking system call, so the bind is performed inline and the resolved
238
+ * address is returned immediately, including the operating-system-assigned
239
+ * ephemeral port when `port` is `0`:
240
+ *
241
+ * ```js
242
+ * const dgram = require('node:dgram');
243
+ *
244
+ * const socket = dgram.createSocket('udp4');
245
+ * const address = socket.bindSync({ address: '0.0.0.0', port: 0 });
246
+ * console.log(address); // e.g. { address: '0.0.0.0', family: 'IPv4', port: 53124 }
247
+ * ```
248
+ *
249
+ * A bind failure such as `EADDRINUSE` is thrown synchronously rather than emitted
250
+ * as an `'error'` event. After `bindSync()` returns, `socket.address()` is
251
+ * valid synchronously and the `'listening'` event is emitted on the next tick.
252
+ *
253
+ * `address` must be a numeric IP literal; `bindSync()` never performs DNS
254
+ * resolution (asynchronous name resolution being the only genuinely blocking part
255
+ * of binding). Incoming datagrams continue to be delivered asynchronously via the
256
+ * `'message'` event. `bindSync()` always binds the socket's own handle and
257
+ * does not participate in [`cluster`](https://nodejs.org/docs/latest-v24.x/api/cluster.html) handle sharing.
258
+ * @since v24.19.0
259
+ * @returns The bound address as returned by `socket.address()`.
260
+ */
261
+ bindSync(options?: BindSyncOptions): AddressInfo;
262
+ /**
263
+ * Close the underlying socket and stop listening for data on it. If a callback is
264
+ * provided, it is added as a listener for the `'close'` event.
265
+ * @since v0.1.99
266
+ * @param callback Called when the socket has been closed.
267
+ */
268
+ close(callback?: () => void): this;
269
+ /**
270
+ * Associates the `dgram.Socket` to a remote address and port. Every
271
+ * message sent by this handle is automatically sent to that destination. Also,
272
+ * the socket will only receive messages from that remote peer.
273
+ * Trying to call `connect()` on an already connected socket will result
274
+ * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not
275
+ * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets)
276
+ * will be used by default. Once the connection is complete, a `'connect'` event
277
+ * is emitted and the optional `callback` function is called. In case of failure,
278
+ * the `callback` is called or, failing this, an `'error'` event is emitted.
279
+ * @since v12.0.0
280
+ * @param callback Called when the connection is completed or on error.
281
+ */
282
+ connect(port: number, address?: string, callback?: () => void): void;
283
+ connect(port: number, callback: () => void): void;
284
+ /**
285
+ * The synchronous counterpart of `socket.connect()`. For a UDP socket
286
+ * `connect(2)` only records the default peer address and is a local, non-blocking
287
+ * system call, so the association is performed inline. Any error raised by the
288
+ * call itself (for example `EAFNOSUPPORT` for a mismatched address family) is
289
+ * thrown synchronously rather than reported via the `'error'` event. Because
290
+ * `connect(2)` does not probe reachability, errors such as `ECONNREFUSED` are
291
+ * still surfaced asynchronously on a later send or receive, exactly as for
292
+ * `socket.connect()`:
293
+ *
294
+ * ```js
295
+ * const dgram = require('node:dgram');
296
+ *
297
+ * const socket = dgram.createSocket('udp4');
298
+ * socket.connectSync(41234, '127.0.0.1');
299
+ * console.log(socket.remoteAddress()); // { address: '127.0.0.1', family: 'IPv4', port: 41234 }
300
+ * ```
301
+ *
302
+ * If the socket is still unbound it is bound synchronously first. After
303
+ * `connectSync()` returns, `socket.remoteAddress()` is valid synchronously
304
+ * and the `'connect'` event is emitted on the next tick. Trying to call
305
+ * `connectSync()` on an already connected socket throws an
306
+ * `ERR_SOCKET_DGRAM_IS_CONNECTED` exception, and calling it while an
307
+ * asynchronous `socket.bind()` is still in progress throws an
308
+ * `ERR_SOCKET_ALREADY_BOUND` exception.
309
+ *
310
+ * `address` must be a numeric IP literal; `connectSync()` never performs DNS
311
+ * resolution (asynchronous name resolution being the only genuinely blocking part
312
+ * of connecting).
313
+ * @since v24.19.0
314
+ * @param address A numeric IP address to connect to. Unlike
315
+ * `socket.connect()`, no DNS resolution is performed, so a host name is not
316
+ * accepted. If omitted, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for
317
+ * `udp6` sockets) is used.
318
+ */
319
+ connectSync(port: number, address?: string): void;
320
+ /**
321
+ * A synchronous function that disassociates a connected `dgram.Socket` from
322
+ * its remote address. Trying to call `disconnect()` on an unbound or already
323
+ * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception.
324
+ * @since v12.0.0
325
+ */
326
+ disconnect(): void;
327
+ /**
328
+ * Instructs the kernel to leave a multicast group at `multicastAddress` using the `IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the
329
+ * kernel when the socket is closed or the process terminates, so most apps will
330
+ * never have reason to call this.
331
+ *
332
+ * If `multicastInterface` is not specified, the operating system will attempt to
333
+ * drop membership on all valid interfaces.
334
+ * @since v0.6.9
335
+ */
336
+ dropMembership(multicastAddress: string, multicastInterface?: string): void;
337
+ /**
338
+ * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
339
+ * @since v8.7.0
340
+ * @return the `SO_RCVBUF` socket receive buffer size in bytes.
341
+ */
342
+ getRecvBufferSize(): number;
343
+ /**
344
+ * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
345
+ * @since v8.7.0
346
+ * @return the `SO_SNDBUF` socket send buffer size in bytes.
347
+ */
348
+ getSendBufferSize(): number;
349
+ /**
350
+ * @since v18.8.0, v16.19.0
351
+ * @return Number of bytes queued for sending.
352
+ */
353
+ getSendQueueSize(): number;
354
+ /**
355
+ * @since v18.8.0, v16.19.0
356
+ * @return Number of send requests currently in the queue awaiting to be processed.
357
+ */
358
+ getSendQueueCount(): number;
359
+ /**
360
+ * By default, binding a socket will cause it to block the Node.js process from
361
+ * exiting as long as the socket is open. The `socket.unref()` method can be used
362
+ * to exclude the socket from the reference counting that keeps the Node.js
363
+ * process active. The `socket.ref()` method adds the socket back to the reference
364
+ * counting and restores the default behavior.
365
+ *
366
+ * Calling `socket.ref()` multiples times will have no additional effect.
367
+ *
368
+ * The `socket.ref()` method returns a reference to the socket so calls can be
369
+ * chained.
370
+ * @since v0.9.1
371
+ */
372
+ ref(): this;
373
+ /**
374
+ * Returns an object containing the `address`, `family`, and `port` of the remote
375
+ * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception
376
+ * if the socket is not connected.
377
+ * @since v12.0.0
378
+ */
379
+ remoteAddress(): AddressInfo;
380
+ /**
381
+ * Broadcasts a datagram on the socket.
382
+ * For connectionless sockets, the destination `port` and `address` must be
383
+ * specified. Connected sockets, on the other hand, will use their associated
384
+ * remote endpoint, so the `port` and `address` arguments must not be set.
385
+ *
386
+ * The `msg` argument contains the message to be sent.
387
+ * Depending on its type, different behavior can apply. If `msg` is a `Buffer`,
388
+ * any `TypedArray` or a `DataView`,
389
+ * the `offset` and `length` specify the offset within the `Buffer` where the
390
+ * message begins and the number of bytes in the message, respectively.
391
+ * If `msg` is a `String`, then it is automatically converted to a `Buffer` with `'utf8'` encoding. With messages that
392
+ * contain multi-byte characters, `offset` and `length` will be calculated with
393
+ * respect to `byte length` and not the character position.
394
+ * If `msg` is an array, `offset` and `length` must not be specified.
395
+ *
396
+ * The `address` argument is a string. If the value of `address` is a host name,
397
+ * DNS will be used to resolve the address of the host. If `address` is not
398
+ * provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) will be used by default.
399
+ *
400
+ * If the socket has not been previously bound with a call to `bind`, the socket
401
+ * is assigned a random port number and is bound to the "all interfaces" address
402
+ * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.)
403
+ *
404
+ * An optional `callback` function may be specified to as a way of reporting
405
+ * DNS errors or for determining when it is safe to reuse the `buf` object.
406
+ * DNS lookups delay the time to send for at least one tick of the
407
+ * Node.js event loop.
408
+ *
409
+ * The only way to know for sure that the datagram has been sent is by using a `callback`. If an error occurs and a `callback` is given, the error will be
410
+ * passed as the first argument to the `callback`. If a `callback` is not given,
411
+ * the error is emitted as an `'error'` event on the `socket` object.
412
+ *
413
+ * Offset and length are optional but both _must_ be set if either are used.
414
+ * They are supported only when the first argument is a `Buffer`, a `TypedArray`,
415
+ * or a `DataView`.
416
+ *
417
+ * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket.
418
+ *
419
+ * Example of sending a UDP packet to a port on `localhost`;
420
+ *
421
+ * ```js
422
+ * import dgram from 'node:dgram';
423
+ * import { Buffer } from 'node:buffer';
424
+ *
425
+ * const message = Buffer.from('Some bytes');
426
+ * const client = dgram.createSocket('udp4');
427
+ * client.send(message, 41234, 'localhost', (err) => {
428
+ * client.close();
429
+ * });
430
+ * ```
431
+ *
432
+ * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`;
433
+ *
434
+ * ```js
435
+ * import dgram from 'node:dgram';
436
+ * import { Buffer } from 'node:buffer';
437
+ *
438
+ * const buf1 = Buffer.from('Some ');
439
+ * const buf2 = Buffer.from('bytes');
440
+ * const client = dgram.createSocket('udp4');
441
+ * client.send([buf1, buf2], 41234, (err) => {
442
+ * client.close();
443
+ * });
444
+ * ```
445
+ *
446
+ * Sending multiple buffers might be faster or slower depending on the
447
+ * application and operating system. Run benchmarks to
448
+ * determine the optimal strategy on a case-by-case basis. Generally speaking,
449
+ * however, sending multiple buffers is faster.
450
+ *
451
+ * Example of sending a UDP packet using a socket connected to a port on `localhost`:
452
+ *
453
+ * ```js
454
+ * import dgram from 'node:dgram';
455
+ * import { Buffer } from 'node:buffer';
456
+ *
457
+ * const message = Buffer.from('Some bytes');
458
+ * const client = dgram.createSocket('udp4');
459
+ * client.connect(41234, 'localhost', (err) => {
460
+ * client.send(message, (err) => {
461
+ * client.close();
462
+ * });
463
+ * });
464
+ * ```
465
+ * @since v0.1.99
466
+ * @param msg Message to be sent.
467
+ * @param offset Offset in the buffer where the message starts.
468
+ * @param length Number of bytes in the message.
469
+ * @param port Destination port.
470
+ * @param address Destination host name or IP address.
471
+ * @param callback Called when the message has been sent.
472
+ */
473
+ send(
474
+ msg: string | NodeJS.ArrayBufferView | readonly any[],
475
+ port?: number,
476
+ address?: string,
477
+ callback?: (error: Error | null, bytes: number) => void,
478
+ ): void;
479
+ send(
480
+ msg: string | NodeJS.ArrayBufferView | readonly any[],
481
+ port?: number,
482
+ callback?: (error: Error | null, bytes: number) => void,
483
+ ): void;
484
+ send(
485
+ msg: string | NodeJS.ArrayBufferView | readonly any[],
486
+ callback?: (error: Error | null, bytes: number) => void,
487
+ ): void;
488
+ send(
489
+ msg: string | NodeJS.ArrayBufferView,
490
+ offset: number,
491
+ length: number,
492
+ port?: number,
493
+ address?: string,
494
+ callback?: (error: Error | null, bytes: number) => void,
495
+ ): void;
496
+ send(
497
+ msg: string | NodeJS.ArrayBufferView,
498
+ offset: number,
499
+ length: number,
500
+ port?: number,
501
+ callback?: (error: Error | null, bytes: number) => void,
502
+ ): void;
503
+ send(
504
+ msg: string | NodeJS.ArrayBufferView,
505
+ offset: number,
506
+ length: number,
507
+ callback?: (error: Error | null, bytes: number) => void,
508
+ ): void;
509
+ /**
510
+ * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP
511
+ * packets may be sent to a local interface's broadcast address.
512
+ *
513
+ * This method throws `EBADF` if called on an unbound socket.
514
+ * @since v0.6.9
515
+ */
516
+ setBroadcast(flag: boolean): void;
517
+ /**
518
+ * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC
519
+ * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_
520
+ * _with a scope index is written as `'IP%scope'` where scope is an interface name_
521
+ * _or interface number._
522
+ *
523
+ * Sets the default outgoing multicast interface of the socket to a chosen
524
+ * interface or back to system interface selection. The `multicastInterface` must
525
+ * be a valid string representation of an IP from the socket's family.
526
+ *
527
+ * For IPv4 sockets, this should be the IP configured for the desired physical
528
+ * interface. All packets sent to multicast on the socket will be sent on the
529
+ * interface determined by the most recent successful use of this call.
530
+ *
531
+ * For IPv6 sockets, `multicastInterface` should include a scope to indicate the
532
+ * interface as in the examples that follow. In IPv6, individual `send` calls can
533
+ * also use explicit scope in addresses, so only packets sent to a multicast
534
+ * address without specifying an explicit scope are affected by the most recent
535
+ * successful use of this call.
536
+ *
537
+ * This method throws `EBADF` if called on an unbound socket.
538
+ *
539
+ * #### Example: IPv6 outgoing multicast interface
540
+ *
541
+ * On most systems, where scope format uses the interface name:
542
+ *
543
+ * ```js
544
+ * const socket = dgram.createSocket('udp6');
545
+ *
546
+ * socket.bind(1234, () => {
547
+ * socket.setMulticastInterface('::%eth1');
548
+ * });
549
+ * ```
550
+ *
551
+ * On Windows, where scope format uses an interface number:
552
+ *
553
+ * ```js
554
+ * const socket = dgram.createSocket('udp6');
555
+ *
556
+ * socket.bind(1234, () => {
557
+ * socket.setMulticastInterface('::%2');
558
+ * });
559
+ * ```
560
+ *
561
+ * #### Example: IPv4 outgoing multicast interface
562
+ *
563
+ * All systems use an IP of the host on the desired physical interface:
564
+ *
565
+ * ```js
566
+ * const socket = dgram.createSocket('udp4');
567
+ *
568
+ * socket.bind(1234, () => {
569
+ * socket.setMulticastInterface('10.0.0.2');
570
+ * });
571
+ * ```
572
+ * @since v8.6.0
573
+ */
574
+ setMulticastInterface(multicastInterface: string): void;
575
+ /**
576
+ * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`,
577
+ * multicast packets will also be received on the local interface.
578
+ *
579
+ * This method throws `EBADF` if called on an unbound socket.
580
+ * @since v0.3.8
581
+ */
582
+ setMulticastLoopback(flag: boolean): boolean;
583
+ /**
584
+ * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
585
+ * "Time to Live", in this context it specifies the number of IP hops that a
586
+ * packet is allowed to travel through, specifically for multicast traffic. Each
587
+ * router or gateway that forwards a packet decrements the TTL. If the TTL is
588
+ * decremented to 0 by a router, it will not be forwarded.
589
+ *
590
+ * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`.
591
+ *
592
+ * This method throws `EBADF` if called on an unbound socket.
593
+ * @since v0.3.8
594
+ */
595
+ setMulticastTTL(ttl: number): number;
596
+ /**
597
+ * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
598
+ * in bytes.
599
+ *
600
+ * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
601
+ * @since v8.7.0
602
+ */
603
+ setRecvBufferSize(size: number): void;
604
+ /**
605
+ * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer
606
+ * in bytes.
607
+ *
608
+ * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket.
609
+ * @since v8.7.0
610
+ */
611
+ setSendBufferSize(size: number): void;
612
+ /**
613
+ * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
614
+ * in this context it specifies the number of IP hops that a packet is allowed to
615
+ * travel through. Each router or gateway that forwards a packet decrements the
616
+ * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded.
617
+ * Changing TTL values is typically done for network probes or when multicasting.
618
+ *
619
+ * The `ttl` argument may be between 1 and 255\. The default on most systems
620
+ * is 64.
621
+ *
622
+ * This method throws `EBADF` if called on an unbound socket.
623
+ * @since v0.1.101
624
+ */
625
+ setTTL(ttl: number): number;
626
+ /**
627
+ * By default, binding a socket will cause it to block the Node.js process from
628
+ * exiting as long as the socket is open. The `socket.unref()` method can be used
629
+ * to exclude the socket from the reference counting that keeps the Node.js
630
+ * process active, allowing the process to exit even if the socket is still
631
+ * listening.
632
+ *
633
+ * Calling `socket.unref()` multiple times will have no additional effect.
634
+ *
635
+ * The `socket.unref()` method returns a reference to the socket so calls can be
636
+ * chained.
637
+ * @since v0.9.1
638
+ */
639
+ unref(): this;
640
+ /**
641
+ * Tells the kernel to join a source-specific multicast channel at the given `sourceAddress` and `groupAddress`, using the `multicastInterface` with the `IP_ADD_SOURCE_MEMBERSHIP` socket
642
+ * option. If the `multicastInterface` argument
643
+ * is not specified, the operating system will choose one interface and will add
644
+ * membership to it. To add membership to every available interface, call `socket.addSourceSpecificMembership()` multiple times, once per interface.
645
+ *
646
+ * When called on an unbound socket, this method will implicitly bind to a random
647
+ * port, listening on all interfaces.
648
+ * @since v13.1.0, v12.16.0
649
+ */
650
+ addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
651
+ /**
652
+ * Instructs the kernel to leave a source-specific multicast channel at the given `sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP` socket option. This method is
653
+ * automatically called by the kernel when the
654
+ * socket is closed or the process terminates, so most apps will never have
655
+ * reason to call this.
656
+ *
657
+ * If `multicastInterface` is not specified, the operating system will attempt to
658
+ * drop membership on all valid interfaces.
659
+ * @since v13.1.0, v12.16.0
660
+ */
661
+ dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void;
662
+ /**
663
+ * events.EventEmitter
664
+ * 1. close
665
+ * 2. connect
666
+ * 3. error
667
+ * 4. listening
668
+ * 5. message
669
+ */
670
+ addListener(event: string, listener: (...args: any[]) => void): this;
671
+ addListener(event: "close", listener: () => void): this;
672
+ addListener(event: "connect", listener: () => void): this;
673
+ addListener(event: "error", listener: (err: Error) => void): this;
674
+ addListener(event: "listening", listener: () => void): this;
675
+ addListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
676
+ emit(event: string | symbol, ...args: any[]): boolean;
677
+ emit(event: "close"): boolean;
678
+ emit(event: "connect"): boolean;
679
+ emit(event: "error", err: Error): boolean;
680
+ emit(event: "listening"): boolean;
681
+ emit(event: "message", msg: NonSharedBuffer, rinfo: RemoteInfo): boolean;
682
+ on(event: string, listener: (...args: any[]) => void): this;
683
+ on(event: "close", listener: () => void): this;
684
+ on(event: "connect", listener: () => void): this;
685
+ on(event: "error", listener: (err: Error) => void): this;
686
+ on(event: "listening", listener: () => void): this;
687
+ on(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
688
+ once(event: string, listener: (...args: any[]) => void): this;
689
+ once(event: "close", listener: () => void): this;
690
+ once(event: "connect", listener: () => void): this;
691
+ once(event: "error", listener: (err: Error) => void): this;
692
+ once(event: "listening", listener: () => void): this;
693
+ once(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
694
+ prependListener(event: string, listener: (...args: any[]) => void): this;
695
+ prependListener(event: "close", listener: () => void): this;
696
+ prependListener(event: "connect", listener: () => void): this;
697
+ prependListener(event: "error", listener: (err: Error) => void): this;
698
+ prependListener(event: "listening", listener: () => void): this;
699
+ prependListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
700
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
701
+ prependOnceListener(event: "close", listener: () => void): this;
702
+ prependOnceListener(event: "connect", listener: () => void): this;
703
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
704
+ prependOnceListener(event: "listening", listener: () => void): this;
705
+ prependOnceListener(event: "message", listener: (msg: NonSharedBuffer, rinfo: RemoteInfo) => void): this;
706
+ /**
707
+ * Calls `socket.close()` and returns a promise that fulfills when the socket has closed.
708
+ * @since v20.5.0
709
+ */
710
+ [Symbol.asyncDispose](): Promise<void>;
711
+ }
712
+ }
713
+ declare module "node:dgram" {
714
+ export * from "dgram";
715
+ }