diff options
author | nlf <quitlahok@gmail.com> | 2020-10-07 00:08:31 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2020-10-09 21:26:35 +0300 |
commit | 0851fc53adfe341533dec498eea296fecd9b06b0 (patch) | |
tree | 4e145accadaf073ff8df3f7857f2d77769a109e5 /lib/utils | |
parent | e859fba9e7c267b0587b7d22da72e33f3e8f906b (diff) |
add file-exists util function
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/file-exists.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/utils/file-exists.js b/lib/utils/file-exists.js new file mode 100644 index 000000000..3149c0ae5 --- /dev/null +++ b/lib/utils/file-exists.js @@ -0,0 +1,8 @@ +const fs = require('fs') +const util = require('util') + +const stat = util.promisify(fs.stat) + +const fileExists = (file) => stat(file).then((stat) => stat.isFile()).catch(() => false) + +module.exports = fileExists |