diff options
Diffstat (limited to 'Timeline/ClientApp/src/data/base64.ts')
-rw-r--r-- | Timeline/ClientApp/src/data/base64.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Timeline/ClientApp/src/data/base64.ts b/Timeline/ClientApp/src/data/base64.ts new file mode 100644 index 00000000..6d846527 --- /dev/null +++ b/Timeline/ClientApp/src/data/base64.ts @@ -0,0 +1,9 @@ +export function base64(blob: Blob): Promise<string> {
+ return new Promise<string>(resolve => {
+ const reader = new FileReader();
+ reader.onload = function() {
+ resolve((reader.result as string).replace(/^data:.+;base64,/, ''));
+ };
+ reader.readAsDataURL(blob);
+ });
+}
|