Last active
September 30, 2022 23:24
-
-
Save antklim/88dd3fcdc820bd949fe74f953578121c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readFile = async (file: string): Promise<string> => | |
await Deno.readTextFile(file); | |
const main = async () => { | |
const file = Deno.env.get("FILE"); | |
if (!file) { | |
console.log("file name required."); | |
return; | |
} | |
console.log(`reading ${file} ...`); | |
try { | |
const text = await readFile(file); | |
console.log(`file content:\n${text}`); | |
} catch (err) { | |
console.error(`failed to read ${file}: ${err}`); | |
} | |
}; | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment