From e307b06982a279e299057159df08f3eac2039b67 Mon Sep 17 00:00:00 2001 From: Danny Lin Date: Sun, 28 Nov 2021 19:48:48 -0800 Subject: [PATCH] util: fs: Add generic file read helper --- src/util/fs.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/fs.ts b/src/util/fs.ts index 5be7b99..99527eb 100644 --- a/src/util/fs.ts +++ b/src/util/fs.ts @@ -57,3 +57,7 @@ export async function withTempDir(callback: (tmp: TempState) => Promise< await fs.rm(dir, { force: true, recursive: true }) } } + +export async function readFile(path: string) { + return await fs.readFile(path, { encoding: 'utf8' }) +}