aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/root-helpers
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/root-helpers')
-rw-r--r--client/src/root-helpers/images.ts13
-rw-r--r--client/src/root-helpers/index.ts1
2 files changed, 14 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}
diff --git a/client/src/root-helpers/index.ts b/client/src/root-helpers/index.ts
index d62f07f9e..63d55d7ef 100644
--- a/client/src/root-helpers/index.ts
+++ b/client/src/root-helpers/index.ts
@@ -1,5 +1,6 @@
1export * from './users' 1export * from './users'
2export * from './bytes' 2export * from './bytes'
3export * from './images'
3export * from './peertube-web-storage' 4export * from './peertube-web-storage'
4export * from './utils' 5export * from './utils'
5export * from './plugins-manager' 6export * from './plugins-manager'