Skip to content

Commit

Permalink
fix: base64 in workers (denoland/deno#6681)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosc90 authored and caspervonb committed Jan 31, 2021
1 parent 90cc2cf commit 97decd1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions encoding/base64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
*/
export function encode(data: string | ArrayBuffer): string {
if (typeof data === "string") {
return window.btoa(data);
return btoa(data);
} else {
const d = new Uint8Array(data);
let dataString = "";
for (let i = 0; i < d.length; ++i) {
dataString += String.fromCharCode(d[i]);
}

return window.btoa(dataString);
return btoa(dataString);
}
}

Expand All @@ -37,5 +37,5 @@ export function decode(data: string): ArrayBuffer {
* @param data input to decode
*/
export function decodeString(data: string): string {
return window.atob(data);
return atob(data);
}

0 comments on commit 97decd1

Please sign in to comment.