Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

JSZip with Blob unexpected behaviour #23

Closed
pbhd opened this Issue · 6 comments

3 participants

@pbhd

Thats not an error, but when trying to use the results of generate it took me a while to figure out what's wrong. See http://stackoverflow.com/questions/13790949/downloading-generated-binary-content-contains-utf-8-encoded-chars-in-disk-file, read the comments to the accepted answer. So from that, I think it would be a good idea to be able to make generate return an Uint8Array on request. But more important would be to add a hint to the documentation about using Blob's (Maybe I missed it? Sorry then) But nevertheless, JSZip is a great thingy, thanks for it.

@dduponchel
Collaborator

Good idea. If JSZip can use the File API (when reading or writing), it will be easier and more straightforward to use in some use cases.
I have started working on it.

@dduponchel
Collaborator

This is on my branch issue23. This should solve the stackoverflow issue with a

sendFile("x.zip", zip.generate({responseType:"blob"}));

I still need to be sure I didn't break older browsers (I will be able to test IE 6-9 the next week).
@Stuk : could you check the updated documentation ? I would like to be sure you're ok with the responseType parameter and the new examples.

@Stuk
Owner

The extra option looks good, but I think just type would be a better name, as there is no response :)

Do you think it would be a good idea to deprecate the base64 option in lieu of type: "base64" to keep things simple?

Finally, could you add the other possible values (uint8array, arraybuffer ) to the jsdoc?

@dduponchel
Collaborator

You're right, type is better. I spent to much time playing with the ajax's responseType :)

I think that deprecating base64 is a good idea : generate({type:"string"}) doesn't clearly show what the output will be (but will confuse the reader) and generate({type:"arraybuffer", base64:true}) doesn't make any sense.

My branch issue23 should be ready this week-end !

@dduponchel dduponchel referenced this issue from a commit in dduponchel/jszip
@dduponchel dduponchel issue #23 feedback
* use type instead of responseType
* deprecate generate({base64:true})
* improve documentation
c415e7f
@dduponchel
Collaborator

JSZip now generates Blobs / ArrayBuffers / Uint8Array, check the documentation. Thanks for the bug report :)

@dduponchel dduponchel closed this
@pbhd
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.