New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Promise[Blob]. #318

Merged
merged 1 commit into from Jul 27, 2016

Conversation

Projects
None yet
1 participant
@dduponchel
Copy link
Collaborator

dduponchel commented Jul 18, 2016

The old code didn't accept promises containing blobs which cause issues
when working with canvas. There are two ways to get a binary content from
a canvas: canvas.toDataURL() and canvas.toBlob(). Working with the
first one involves a substring to remove the data url part and a base64
decode. The other one ends up with a Promise[Blob], fixed by this
commit. Now, we can extract the binary content of a canvas like:

var p = new JSZip.external.Promise(function (resolve, reject) {
    canvas.toBlob(function (blob) {
        resolve(blob);
    });
});
Support Promise[Blob].
The old code didn't accept promises containing blobs which cause issues
when working with canvas. There are two ways to get a binary content from
a canvas: `canvas.toDataURL()` and `canvas.toBlob()`. Working with the
first one involves a substring to remove the data url part and a base64
decode. The other one ends up with a Promise[Blob], fixed by this
commit. Now, we can extract the binary content of a canvas like:

```js
var p = new JSZip.external.Promise(function (resolve, reject) {
    canvas.toBlob(function (blob) {
        resolve(blob);
    });
});
```

@dduponchel dduponchel merged commit a9d2263 into Stuk:master Jul 27, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@dduponchel dduponchel deleted the dduponchel:promise_blob branch Jul 27, 2016

@dduponchel dduponchel referenced this pull request Aug 2, 2016

Merged

Release v3.1.0 #326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment