Skip to content

Commit

Permalink
fix(node-resolve): fs.exists is incorrectly promisified (#835)
Browse files Browse the repository at this point in the history
Co-authored-by: Liam McLoughlin <lmcloughlin@google.com>
  • Loading branch information
Hexxeh and Hexxeh committed Mar 16, 2021
1 parent 2d06c44 commit 312fbc2
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 312fbc2

Please sign in to comment.