existsAsync is broken
chrisgbk opened this issue · 1 comments
chrisgbk commented
The fs library is promisified, but this function still calls it like it was the callback version.
Patch:
const existsAsync = path => {
return new Promise((resolve, reject) => {
fs.stat(path).then( stat => {
if (stat.isDirectory()) {
resolve("dir");
} else if (stat.isFile()) {
resolve("file");
} else {
resolve("other");
}
}).catch( err => {
if (err.code === "ENOENT") {
resolve(false);
} else {
reject(err);
}
});
});
};
szwacz commented
Good catch! Fixed in v1.3.1