Promise 形式的 API


dns.promises API 提供了一组替代的异步 DNS 方法,这些方法返回 Promise 对象而不是使用回调。 API 可通过 require('node:dns').promisesrequire('node:dns/promises') 访问。

The dns.promises API provides an alternative set of asynchronous DNS methods that return Promise objects rather than using callbacks. The API is accessible via require('node:dns').promises or require('node:dns/promises').