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 15, 2021
1 parent 2d06c44 commit 4b58114
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/node-resolve/src/fs.js
Expand Up @@ -2,8 +2,16 @@ import fs from 'fs';

import { promisify } from 'util';

export const exists = promisify(fs.exists);
export const access = promisify(fs.access);
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 access(filePath);
return true;
} catch {
return false;
}
}

0 comments on commit 4b58114

Please sign in to comment.