MCPcopy Create free account
hub / github.com/cloudflare/wildebeest / arrayBufferToBase64

Function arrayBufferToBase64

backend/src/webpush/util.ts:19–26  ·  view source on GitHub ↗
(buffer: ArrayBuffer)

Source from the content-addressed store, hash-verified

17}
18
19export function arrayBufferToBase64(buffer: ArrayBuffer): string {
20 let bin = ''
21 const uint8 = new Uint8Array(buffer)
22 uint8.forEach((code: number) => {
23 bin += String.fromCharCode(code)
24 })
25 return btoa(bin)
26}
27
28export function b64ToUrlEncoded(str: string): string {
29 return str.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+/g, '')

Callers 1

signDataFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected