Created
September 13, 2018 15:30
-
-
Save tkssharma/11a7c4847aa4f27f1d0baa0fe1fc6fb8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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); | |
| readFileAsync(filePath, {encoding: 'utf8'}) | |
| .then((text) => { | |
| console.log('CONTENT:', text); | |
| }) | |
| .catch((err) => { | |
| console.log('ERROR:', err); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment