From 67bc09ccfd94a7f5eaa80e68a0a0ac783c4c6cff Mon Sep 17 00:00:00 2001 From: Corentin Thomasset Date: Mon, 17 May 2021 19:58:33 +0200 Subject: [PATCH] feat(tools): added base64 string converter --- .../converter/base64-string-converter.vue | 60 +++++++++++++++++++ utils/convert.ts | 7 +++ 2 files changed, 67 insertions(+) create mode 100644 pages/tools/converter/base64-string-converter.vue create mode 100644 utils/convert.ts diff --git a/pages/tools/converter/base64-string-converter.vue b/pages/tools/converter/base64-string-converter.vue new file mode 100644 index 00000000..94c3b1e2 --- /dev/null +++ b/pages/tools/converter/base64-string-converter.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/utils/convert.ts b/utils/convert.ts new file mode 100644 index 00000000..abe9f983 --- /dev/null +++ b/utils/convert.ts @@ -0,0 +1,7 @@ +const base64ToString = (str: string) => Buffer.from(str, 'base64').toString('utf-8') +const stringToBase64 = (str: string) => Buffer.from(str, 'utf-8').toString('base64') + +export { + stringToBase64, + base64ToString +}