Skip to content

Instantly share code, notes, and snippets.



Last active Mar 27, 2021
What would you like to do?
import * as path from "";
async function getTextFile(filepath: string) {
if (import.meta.url.startsWith("file://")) {
return await Deno.readTextFile(filepath);
} else {
const dir = path.dirname(import.meta.url);
const dest = path.join(dir, filepath);
const result = await fetch(dest).then((res) => res.text());
return result;
console.log(await getTextFile("./template.html"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment