From 93ce8560fa19c3a91de99643fdbbe4f895a47b84 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 11 Jun 2020 17:27:15 +0800 Subject: feat(front): Service worker is coming! --- Timeline/ClientApp/src/app/data/base64.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Timeline/ClientApp/src/app/data/base64.ts (limited to 'Timeline/ClientApp/src/app/data/base64.ts') diff --git a/Timeline/ClientApp/src/app/data/base64.ts b/Timeline/ClientApp/src/app/data/base64.ts new file mode 100644 index 00000000..7f7c6fcc --- /dev/null +++ b/Timeline/ClientApp/src/app/data/base64.ts @@ -0,0 +1,9 @@ +export function base64(blob: Blob): Promise { + return new Promise(resolve => { + const reader = new FileReader(); + reader.onload = function() { + resolve((reader.result as string).replace(/^data:.+;base64,/, '')); + }; + reader.readAsDataURL(blob); + }); +} -- cgit v1.2.3