fs-readfile-promise
Promisified version of fs.readFile
const readFilePromise = ; async { const buffer = await ; buffer; //=> '... file contents ...'};
Based on the principle of modular programming, this module has only one functionality 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.
Installation
npm install fs-readfile-promise
API
const readFilePromise = ;
readFile(path [, options])
path: string
Buffer
URL
integer
options: Object
(fs.readFile options) or string
(encoding)
Return: Promise<Buffer|string>
async { await ; //=> <Buffer 48 69 2e> await ; //=> 'Hi.' await ; //=> 'SGku'};
License
ISC License © 2017 Shinnosuke Watanabe