Trouble With Binary String In Javascript Above Character Code 128
So I'm trying to create and save a binary file locally in javascript using this library: https://github.com/eligrey/FileSaver.js/ It is a bit tricky because I am using GameMaker st
Solution 1:
Instead of using a String
, you'd probably be better off using a Uint8Array
(meaning an array of unsigned bytes in the range 0–255); see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array. For example:
ildablob[argument0] = new Uint8Array(1);
ildablob[argument0][0] = argument1;
...
var blob = new Blob(ildablob, {type: "application/octet-stream"});
Also, incidentally — argument0
and argument1
are terrible variable-names. You mention that you're constrained by GameMaker; is that the reason for this? It seems like there should be some way to fix that.
Post a Comment for "Trouble With Binary String In Javascript Above Character Code 128"