Skip to content

Instantly share code, notes, and snippets.

@mitzen
Created May 15, 2023 09:31
Show Gist options
  • Save mitzen/9af967b0b9df6a29e87c5eaaf8506f1e to your computer and use it in GitHub Desktop.
Save mitzen/9af967b0b9df6a29e87c5eaaf8506f1e to your computer and use it in GitHub Desktop.
// remember to wrap it up in try/catch
async function lookupPromise() {
return new Promise((resolve, reject) => {
dns.lookup("www.aWebSiteName.am", (err, address, family) => {
if(err) reject(err);
resolve(address);
});
});
};
try {
const address = await lookupPromise();
} catch(err) {
console.error(err);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment