Skip to content

Commit e3d7590

Browse files
committed
Adds base64 function
1 parent 3ed0ea1 commit e3d7590

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/system/string.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export namespace Strings {
1515
Backslash = 92
1616
}
1717

18+
export function base64(s: string): string {
19+
const buffer = Buffer.from(s);
20+
return buffer.toString('base64');
21+
}
22+
1823
const escapeMarkdownRegex = /[\\`*_{}[\]()#+\-.!]/g;
1924
const escapeMarkdownHeaderRegex = /^===/gm;
2025
// 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___';

0 commit comments

Comments
 (0)