@catladder/cli
Version:
Panter cli tool for cloud CI/CD and DevOps
13 lines (10 loc) • 315 B
text/typescript
import { readFile as fsExtraReadFile } from "fs-extra";
const readFile = (file: string) => fsExtraReadFile(file, { encoding: "utf-8" });
export const readFileOrError = async (filePath: string) => {
try {
const file = await readFile(filePath);
return [null, file];
} catch (e) {
return [e];
}
};