We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d5faadc commit 3c37f2aCopy full SHA for 3c37f2a
lib/fileUtils.js
@@ -10,8 +10,14 @@ module.exports = function(fs) {
10
function statFile(filePath) {
11
return new Promise(function(resolve, reject) {
12
fs.stat(filePath, function(err, stat) {
13
- // No rejection here as it is ok if the file was not found
14
- resolve(stat ? {path: filePath, stat: stat} : null);
+ if (err) {
+ if (err.code === "ENOENT") { // "File or directory does not exist"
15
+ return resolve(null);
16
+ } else {
17
+ return reject(err);
18
+ }
19
20
+ resolve({path: filePath, stat});
21
});
22
23
}
0 commit comments