export class Files { static toString(f: File | Blob): Promise { const reader = new window.FileReader() reader.readAsDataURL(f) return new Promise((resolve) => { reader.onloadend = () => resolve(reader.result as string) }) } static fromString(s: string): Promise { return fetch(s).then((r) => r.blob()) } }