MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / toBase64

Function toBase64

console/src/utils/format.ts:23–27  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

21 * non-ASCII characters by first encoding the string as UTF-8.
22 */
23export const toBase64 = (str: string): string => {
24 const bytes = new TextEncoder().encode(str);
25 const binary = Array.from(bytes, (b) => String.fromCharCode(b)).join("");
26 return btoa(binary);
27};
28
29const kilobyte = 1024n;
30const megabyte = 1024n * 1024n;

Callers 2

ConnectModalFunction · 0.90
SecretBoxFunction · 0.90

Calls 3

encodeMethod · 0.45
joinMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected