Last active
March 8, 2020 19:05
-
-
Save artiya4u/5b26d6a81f58f07acfb281235ea39af8 to your computer and use it in GitHub Desktop.
Use callback function from .then
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {promisify} = require('util'); | |
const fs = require('fs'); | |
const readFileAsync = promisify(fs.readFile); | |
const filePath = 'index.js'; | |
readFileAsync(filePath, {encoding: 'utf8'}).then(function (text) { | |
console.log(text); | |
}).catch(function (error) { | |
console.log(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment