aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/root-helpers/images.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/root-helpers/images.ts')
-rw-r--r--client/src/root-helpers/images.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/client/src/root-helpers/images.ts b/client/src/root-helpers/images.ts
new file mode 100644
index 000000000..fb229ce6d
--- /dev/null
+++ b/client/src/root-helpers/images.ts
@@ -0,0 +1,13 @@
1function imageToDataURL (input: File | Blob) {
2 return new Promise<string>(res => {
3 const reader = new FileReader()
4
5 reader.onerror = err => console.error('Cannot read input file.', err)
6 reader.onloadend = () => res(reader.result as string)
7 reader.readAsDataURL(input)
8 })
9}
10
11export {
12 imageToDataURL
13}