MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / bytesToBase64

Function bytesToBase64

packages/@stdlib/base64/src/base64.ts:7–21  ·  view source on GitHub ↗
(
  input: Uint8Array,
  params?: { urlSafe?: boolean; padding?: boolean },
)

Source from the content-addressed store, hash-verified

5 return Base64.toUint8Array(input);
6}
7export function bytesToBase64(
8 input: Uint8Array,
9 params?: { urlSafe?: boolean; padding?: boolean },
10): string {
11 let result = Base64.fromUint8Array(
12 new Uint8Array(input),
13 params?.urlSafe ?? true,
14 );
15
16 if (!params?.urlSafe && !params?.padding) {
17 result = result.replace(/=+$/, '');
18 }
19
20 return result;
21}
22
23export function base64ToBytesSafe<T extends string | null | undefined>(
24 input: T,

Callers 11

encodePasswordHashFunction · 0.90
getAllPageUpdatesFunction · 0.90
squashPageUpdatesFunction · 0.90
bufferizePageUpdateFunction · 0.90
index.tsFile · 0.90
loginFunction · 0.90
tryRefreshTokensFunction · 0.90
copyMethod · 0.90
bytesToBase64SafeFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected