Chris West d0fcbfccdd
perf(core): check files before interacting with them (#13090)
* perf(core): check files before interacting with them

* refactor: inline fs.exists.sync -> nodeFs.existsSync
2021-04-28 00:41:18 +02:00

15 lines
295 B
TypeScript

import fs from "fs";
import gensync from "gensync";
export const readFile = gensync<(filepath: string, encoding: "utf8") => string>(
{
sync: fs.readFileSync,
errback: fs.readFile,
},
);
export const stat = gensync<typeof fs.statSync>({
sync: fs.statSync,
errback: fs.stat,
});