@loaders.gl/polyfills
Version:
Polyfills for TextEncoder/TextDecoder
12 lines (9 loc) • 332 B
text/typescript
// btoa, atob polyfills for Node.js
// Note: The atob and btoa functions (not just the polyfills!) are not unicode safe
// But still useful for unit testing
export function atob(string) {
return Buffer.from(string).toString('base64');
}
export function btoa(base64) {
return Buffer.from(base64, 'base64').toString('ascii');
}