Skip to content

Commit

Permalink
rework browser handling for buffer decoding (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored Sep 7, 2024
1 parent 0f605c4 commit ba0c8fd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ function copyLE (src, outBuf16) {

function getWasmBytes() {
const binary = 'WASM_BINARY'; // This string will be replaced by build.js.
if ((typeof window !== 'undefined' || typeof self !== 'undefined') && typeof atob === 'function')
return Uint8Array.from(atob(binary), x => x.charCodeAt(0));
return Buffer.from(binary, 'base64');
if (typeof Buffer !== 'undefined')
return Buffer.from(binary, 'base64');
return Uint8Array.from(atob(binary), x => x.charCodeAt(0));
}

let initPromise;
Expand Down

0 comments on commit ba0c8fd

Please sign in to comment.