Answers for "convert functoin with call back to promise"

1

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)
    })
  })
}
Posted by: Guest on August-12-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language