Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 193x 193x 193x 193x 25x 25x 25x 25x 25x 25x 25x | import { promises as fs } from 'node:fs';
import { join } from 'node:path';
export function findPath(dir, name) {
const fullPath = join(dir, name);
return fs
.stat(fullPath)
.then(() => dir)
.catch((e) => {
if (e.code === 'ENOENT' && dir !== '/') {
const parent = join(dir, '..');
return findPath(parent, name);
}
throw e;
});
}
|