javascript convert code from call backs to promises code example
Example: convert functoin with call back to promise
const readFilePromise = () => {
return new Promise((resolve, reject) => {
fs.readFile(filePath, options, (err, data) => {
if (err) return reject(err)
resolve(data)
})
})
}