Description
I am using your lib to upload images to github and I came across this error "RangeError: Maximum call stack size exceeded." in chrome & safari when uploading. I found this discussion:
http://stackoverflow.com/questions/3195865/converting-byte-array-to-string-in-javascript
and I tried the suggestion in lovasoa's toBinString function and changed the code around line 366 from:
content = {
"content": btoa(String.fromCharCode.apply(null, new Uint8Array(content))),
"encoding": "base64"
};
to
var uarr = new Uint8Array(content);
var strings = [], chunksize = 0xffff;
var len = uarr.length;
// There is a maximum stack size. We cannot call String.fromCharCode with as many arguments as we want
for (var i = 0; i * chunksize < len; i++){
strings.push(String.fromCharCode.apply(null, uarr.subarray(i * chunksize, (i + 1) * chunksize)));
}
content = {
"content": btoa(strings.join('')),
"encoding": "base64"
};
It seems to work now. I have not done tons of testing, but I thought I'd file a bug if someone has some time to check it out.