diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/demo/wat2wasm/demo.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/demo/wat2wasm/demo.js b/docs/demo/wat2wasm/demo.js index 1300022b..1fcd42cb 100644 --- a/docs/demo/wat2wasm/demo.js +++ b/docs/demo/wat2wasm/demo.js @@ -117,7 +117,9 @@ function compile() { var binaryOutput = module.toBinary({log: true, write_debug_names:true}); outputLog = binaryOutput.log; binaryBuffer = binaryOutput.buffer; - outputBase64 = btoa(binaryBuffer); + // binaryBuffer is a Uint8Array, so we need to convert it to a string to use btoa + // https://stackoverflow.com/questions/12710001/how-to-convert-uint8-array-to-base64-encoded-string + outputBase64 = btoa((String.fromCharCode.apply(null, binaryBuffer)); var blob = new Blob([binaryOutput.buffer]); if (binaryBlobUrl) { |