Skip to content

Commit 3c878c9

Browse files
committed
fix
1 parent 96aff4c commit 3c878c9

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

src/utils/fs.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
const fs = require("fs")
2-
const path = require("path")
32

43
function exists(p) {
5-
fs.stat(p, function (err, stat) {
6-
if (err == null) {
7-
return true
8-
} else if (err.code === "ENOENT") {
9-
return false
10-
} else {
11-
return false
12-
}
13-
})
4+
try {
5+
fs.statSync(p)
6+
return true
7+
} catch (err) {
8+
return false
9+
}
1410
}
1511

1612
module.exports = { exists }

0 commit comments

Comments
 (0)