feat(runner): add new charword command to runner

This commit is contained in:
Haoyu Xu
2023-02-05 16:56:08 -05:00
parent b32f07ccb3
commit 470e939a2a
5 changed files with 36 additions and 16 deletions

View File

@@ -16,7 +16,10 @@ export async function read(filePath, encoding = 'utf8') {
}
export function readSync(filePath, encoding = 'utf8') {
return fs.readFileSync(filePath, encoding, { flag: 'r' })
if (exists(filePath)) {
return fs.readFileSync(filePath, encoding, { flag: 'r' })
}
return null
}
export function exists(filePath) {