velt/net/dns
import { lookup } from "velt/net/dns". Host name resolution through the system resolver.
lookup(host): Promise<string[]>: every address, IPv4 and IPv6, without duplicates. ThrowsIoErrorENOENTwhen the name doesn't resolve.lookupOne(host): Promise<string>: the address a connect would try first.
ts
import { lookup, lookupOne } from "velt/net/dns";
console.log((await lookup("localhost")).length > 0, await lookupOne("127.0.0.1"));
try {
await lookup("no-such-host.invalid");
} catch (e) {
console.log(e.code); // ENOENT
}