refactor: move b64ToBuf from libweb
This commit is contained in:
parent
bb1229eeb2
commit
b46bd6048e
|
@ -115,4 +115,9 @@ function encodeU64(num: bigint): [Uint8Array, Err] {
|
|||
return [encoded, null];
|
||||
}
|
||||
|
||||
export { objAsString, addContextToErr, encodeU64, decodeU64 };
|
||||
function bufToB64(buf: Uint8Array): string {
|
||||
const b64Str = btoa(String.fromCharCode(...buf));
|
||||
return b64Str.replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");
|
||||
}
|
||||
|
||||
export { objAsString, addContextToErr, encodeU64, decodeU64, bufToB64 };
|
||||
|
|
Loading…
Reference in New Issue