my question is that im running node.js, and i have 2 functions that needs to be run in a specific order, however they are not returning a promise at this this. So i wonder how would i rewrite this to make sure that the main function would return a promise, and if i have nested functions, do i just run the 2nd function from the 1st functions resolve?
Here is the code:
handleMd5Convert = (file) => {
fs.readFile(file, (err, buf) => {
fs.rename(file, directoryPath + md5(buf) + '.mp3', (err) => {
if (err) console.log('ERROR: ' + err);
})
})
})
HandleMd5Convert should be able to to .then()
/Alex