is there a way to use the mv npm module in an async/await manner? not with a callback as provided in docs. Or is there any other module that does the same job? thanks
var mv = require('mv'); mv('source/file', 'dest/file', function(err) { ... });
You can use the promisify function of the util package
promisify
util
const util = require('util'); const mv = require('mv'); const mvPromise = util.promisify(mv); await mv('source/file', 'dest/file');
1.4m articles
1.4m replys
5 comments
57.0k users