Skip to content

Instantly share code, notes, and snippets.

@mizchi
Created September 7, 2019 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mizchi/8620e870ef043e37b93af5fb668c3903 to your computer and use it in GitHub Desktop.
Save mizchi/8620e870ef043e37b93af5fb668c3903 to your computer and use it in GitHub Desktop.
import "regenerator-runtime/runtime";
const tx = document.createElement("textarea") as HTMLTextAreaElement;
document.body.appendChild(tx);
const btn = document.createElement("button");
btn.textContent = "start";
document.body.appendChild(btn);
btn.addEventListener("click", async (ev: any) => {
// @ts-ignore
const fileHandler = await window.chooseFileSystemEntries();
const file = await fileHandler.getFile();
tx.value = await file.text();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment