misc_pterodactyl-panel/resources/scripts/lib/buffer.ts
2022-10-31 12:18:25 -06:00

9 lines
283 B
TypeScript

function decodeBuffer(value: string): ArrayBuffer {
return Uint8Array.from(window.atob(value), c => c.charCodeAt(0));
}
function encodeBuffer(value: ArrayBuffer): string {
return btoa(String.fromCharCode(...new Uint8Array(value)));
}
export { decodeBuffer, encodeBuffer };