Skip to content

Commit 6e9e123

Browse files
author
Nathanael BOT
committed
doc: clarify dns.lookup callback signatures with options.all
Signed-off-by: Nathanael BOT <nathanaelbot@minidenathanael.home>
1 parent 08d6bd1 commit 6e9e123

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

doc/api/dns.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,19 +277,20 @@ changes:
277277
* `callback` {Function}
278278
* `err` {Error}
279279
* `address` {string} A string representation of an IPv4 or IPv6 address.
280+
This argument is only provided when `options.all` is `false`.
280281
* `family` {integer} `4` or `6`, denoting the family of `address`, or `0` if
281282
the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a
282-
bug in the name resolution service used by the operating system.
283+
bug in the name resolution service used by the operating system. This
284+
argument is only provided when `options.all` is `false`.
285+
* `addresses` {Object[]} Returned when `options.all` is `true`.
286+
* `address` {string} A resolved IPv4 or IPv6 address.
287+
* `family` {integer} `4` or `6`, denoting the family of `address`.
283288

284289
Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
285290
AAAA (IPv6) record. All `option` properties are optional. If `options` is an
286291
integer, then it must be `4` or `6` – if `options` is not provided, then
287292
either IPv4 or IPv6 addresses, or both, are returned if found.
288293

289-
With the `all` option set to `true`, the arguments for `callback` change to
290-
`(err, addresses)`, with `addresses` being an array of objects with the
291-
properties `address` and `family`.
292-
293294
On error, `err` is an [`Error`][] object, where `err.code` is the error code.
294295
Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
295296
the host name does not exist but also when the lookup fails in other ways

0 commit comments

Comments
 (0)