mirror of
https://github.com/nodejs/node.git
synced 2025-05-20 23:55:47 +00:00

PR-URL: https://github.com/nodejs/node/pull/36572 Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
11 lines
217 B
JavaScript
11 lines
217 B
JavaScript
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
|