From e3d7590c1107a1e057c707e2f7e9ec9b0be3fda5 Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Mon, 23 Sep 2019 23:57:26 -0400 Subject: [PATCH] Adds base64 function --- src/system/string.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/system/string.ts b/src/system/string.ts index 44955db..824097f 100644 --- a/src/system/string.ts +++ b/src/system/string.ts @@ -15,6 +15,11 @@ export namespace Strings { Backslash = 92 } + export function base64(s: string): string { + const buffer = Buffer.from(s); + return buffer.toString('base64'); + } + const escapeMarkdownRegex = /[\\`*_{}[\]()#+\-.!]/g; const escapeMarkdownHeaderRegex = /^===/gm; // const sampleMarkdown = '## message `not code` *not important* _no underline_ \n> don\'t quote me \n- don\'t list me \n+ don\'t list me \n1. don\'t list me \nnot h1 \n=== \nnot h2 \n---\n***\n---\n___';