Manually promisifying a callback

suggest change

Most Node.js file-system operations now have promise-based versions. Prefer them over manually wrapping deprecated callback APIs:

const { access } = require('node:fs/promises');

async function main() {
    await access(__filename);
    console.log('file exists!');
}

main().catch(console.error);
file exists!

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents