Binary data #6

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

Comments

Projects
None yet
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.

@ghost ghost assigned Stuk Oct 27, 2011

@Stuk

This comment has been minimized.

Show comment
Hide comment
@Stuk

Stuk Oct 27, 2011

Owner

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

Owner

Stuk commented Oct 27, 2011

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

@dpup

This comment has been minimized.

Show comment
Hide comment
@dpup

dpup 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.

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

This comment has been minimized.

Show comment
Hide comment
@Stuk

Stuk Oct 31, 2011

Owner

Thanks! I'll look into that

Owner

Stuk commented Oct 31, 2011

Thanks! I'll look into that

dduponchel added a commit to dduponchel/jszip that referenced this issue Nov 28, 2011

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).

@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