Skip to content

Commit

Permalink
Fix bug where fs.exists is incorrectly promisified
Browse files Browse the repository at this point in the history
  • Loading branch information
Hexxeh committed Mar 12, 2021
1 parent 2d06c44 commit 0b912c3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/node-resolve/src/fs.js
Expand Up @@ -2,8 +2,15 @@ import fs from 'fs';

import { promisify } from 'util';

export const exists = promisify(fs.exists);
export const readFile = promisify(fs.readFile);
export const realpath = promisify(fs.realpath);
export { realpathSync } from 'fs';
export const stat = promisify(fs.stat);
export async function exists(filePath) {
try {
await stat(filePath);
return true;
} catch {
return false;
}
}

0 comments on commit 0b912c3

Please sign in to comment.