Created the file util

This commit is contained in:
Mathias Wagner 2023-05-30 23:16:40 +02:00
parent e814816465
commit eebac9193e
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -0,0 +1,12 @@
export const uploadString = () => new Promise((resolve) => {
const input = document.createElement("input");
input.type = "file";
input.accept = "text/plain";
input.onchange = (e) => {
const file = e.target.files[0];
const reader = new FileReader();
reader.onload = (e) => resolve(e.target.result);
reader.readAsText(file);
};
input.click();
});