Promise version of fs.readFile
npm install fs-readfile-promise



Promisified version of [fs.readFile][fs.readfile]
``javascript
const readFilePromise = require('fs-readfile-promise');
(async () => {
const buffer = await readFile('path/to/a/file');
buffer.toString(); //=> '... file contents ...'
})();
`
Based on the principle of modular programming, this module has only one functionality [readFile][fs.readfile], unlike other Promise-based file system modules. If you'd like to use a bunch of other fs methods in the Promise way, choose other modules such as q-io and promise-fs.
``
npm install fs-readfile-promise
`javascript`
const readFilePromise = require('fs-readfile-promise');
path: string Buffer URL integer Object
options: ([fs.readFile] options) or string (encoding) Promise
Return:
`javascript
(async () => {
await readFilePromise('src.txt'); //=>
await readFilePromise('src.txt', 'utf8'); //=> 'Hi.'
await readFilePromise('src.txt', {encoding: 'base64'}); //=> 'SGku'
})();
``
ISC License © 2017 Shinnosuke Watanabe
[fs.readfile]: https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback