File size: 297 Bytes
1f122c3
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
export function base64FromBytes(arr: Uint8Array): string {
	if (globalThis.Buffer) {
		return globalThis.Buffer.from(arr).toString("base64");
	} else {
		const bin: string[] = [];
		arr.forEach((byte) => {
			bin.push(String.fromCharCode(byte));
		});
		return globalThis.btoa(bin.join(""));
	}
}