blob: 823400273dbb16a6bf37e76530849aea33eb12d7 (
plain)
1
2
3
4
5
6
7
8
9
|
import base64js from 'base64-js';
export default function toBase64String(buffer: ArrayBuffer): string {
// TODO: Make sure converting buffer to Uint8Array() is correct
return base64js.fromByteArray(new Uint8Array(buffer))
.replace(/\+/g, "-")
.replace(/\//g, "_")
.replace(/=/g, "");
}
|