diff --git a/lib/wrapped-fs.js b/lib/wrapped-fs.js index 4dad09c..f8256e3 100644 --- a/lib/wrapped-fs.js +++ b/lib/wrapped-fs.js @@ -5,18 +5,24 @@ const { promisify } = require('util') const fs = process.versions.electron ? require('original-fs') : require('fs') const mkdirp = require('mkdirp') -const methods = [ +const promisifiedMethods = [ 'lstat', 'readFile', 'stat', 'writeFile' ] -for (const method of methods) { - fs[method] = promisify(fs[method]) +const promisified = {} + +for (const method of Object.keys(fs)) { + if (promisifiedMethods.includes(method)) { + promisified[method] = promisify(fs[method]) + } else { + promisified[method] = fs[method] + } } // To make it more like fs-extra -fs.mkdirp = promisify(mkdirp) -fs.mkdirpSync = mkdirp.sync +promisified.mkdirp = promisify(mkdirp) +promisified.mkdirpSync = mkdirp.sync -module.exports = fs +module.exports = promisified