Skip to content

Binary data #6

Closed
dpup opened this Issue Oct 15, 2011 · 3 comments

2 participants

@dpup
dpup commented Oct 15, 2011

Couldn't think of a better place to post this.

Your example has a note about getting this to work with binary data retrieved via XHR. You can get it to work using something like so:

xhr.open('GET', imageUrl);
xhr.overrideMimeType('text/plain; charset=x-user-defined');
xhr.send(null);

Then process the data:

var data = xhr.responseText;
var bytes = [];
for (var i = 0; i < data.length; i++) {
bytes.push(String.fromCharCode(data.charCodeAt(i) & 0xff));
}

Great little library btw, super useful.

@Stuk Stuk was assigned Oct 27, 2011
@Stuk
Owner
Stuk commented Oct 27, 2011

Thanks very much, I'll update the tests soon :)

@dpup
dpup commented Oct 27, 2011

Also, if you want to get around the 2MB limit for data urls you can use the new BlobBuilder API and window.URL.createObjectURL(blob). That'll significantly reduce browser compatibility though.

@Stuk
Owner
Stuk commented Oct 31, 2011

Thanks! I'll look into that

@dduponchel dduponchel added a commit to dduponchel/jszip that referenced this issue Nov 28, 2011
@dduponchel dduponchel add tests for issue #7, use ajax (issue #6)
The ajax code has been tested in :
- IE 6 / 7 / 8 / 9
- the lastest firefox
- firefox 3.6
- the lastest opera
- the lastest chromium
- the lastest safari

The tests pass in all those browsers (except in IE 9 : the utf8 test was
broken, I didn't fixed it).
d71158b
@Stuk Stuk closed this Mar 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.