* perf(core): check files before interacting with them * refactor: inline fs.exists.sync -> nodeFs.existsSync
15 lines
295 B
TypeScript
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,
|
|
});
|