Manually promisifying a callback
suggest changeMost 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!
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents