1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 5x 5x 5x 5x | import FS from 'fs' export default function readFile(path, options) { let { async, ...fsOpts } = options Eif (async) return new Promise( (resolve, reject) => FS.readFile(path, fsOpts, (error, content) => error ? reject(error) : resolve(content)) ) else return FS.readFileSync(path, fsOpts) } |