Skip to content

Commit 020fa33

Browse files
authored
Release preparation for 3.10.2 (#974)
Release preparation for 3.10.2 - Fix cross-realm binary type detection in `getTypeOf`. Fixes [#759](#759) (see [#578](#578)) - Add missing types for `JSZip.defaults`. Fixes [#690](#690) (see [#927](#927)) - Fix Blob support in Node.js 18 and up. Fixes [#941](#941) (see [#955](#955)) - Fix grunt build rebundling existing dist via browser field (see [#971](#971)) - Move all continuous integration to GitHub Actions (see [#942](#942)) - Upgrade Playwright to the latest version (see [#940](#940)) - Create FUNDING.yml Signed-off-by: Jon Koops <jonkoops@gmail.com>
1 parent d38fda5 commit 020fa33

7 files changed

Lines changed: 41 additions & 26 deletions

File tree

‎CHANGES.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ layout: default
44
section: main
55
---
66

7+
### v3.10.2 2026-09-09
8+
9+
- Fix cross-realm binary type detection in `getTypeOf`. Fixes [#759](https://github.com/Stuk/jszip/issues/759) (see [#578](https://github.com/Stuk/jszip/pull/578))
10+
- Add missing types for `JSZip.defaults`. Fixes [#690](https://github.com/Stuk/jszip/issues/690) (see [#927](https://github.com/Stuk/jszip/pull/927))
11+
- Fix Blob support in Node.js 18 and up. Fixes [#941](https://github.com/Stuk/jszip/issues/941) (see [#955](https://github.com/Stuk/jszip/pull/955))
12+
713
### v3.10.1 2022-08-02
814

915
- Add sponsorship files.

‎dist/jszip.js‎

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
3-
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
3+
JSZip v3.10.2 - A JavaScript class for generating and reading zip files
44
<http://stuartk.com/jszip>
55
66
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
@@ -1057,7 +1057,7 @@ JSZip.defaults = require("./defaults");
10571057

10581058
// TODO find a better way to handle this version,
10591059
// a require('package.json').version doesn't work with webpack, see #327
1060-
JSZip.version = "3.10.1";
1060+
JSZip.version = "3.10.2";
10611061

10621062
JSZip.loadAsync = function (content, options) {
10631063
return new JSZip().loadAsync(content, options);
@@ -3390,16 +3390,17 @@ exports.getTypeOf = function(input) {
33903390
if (typeof input === "string") {
33913391
return "string";
33923392
}
3393-
if (Object.prototype.toString.call(input) === "[object Array]") {
3393+
var proto = Object.prototype.toString.call(input);
3394+
if (proto === "[object Array]") {
33943395
return "array";
33953396
}
33963397
if (support.nodebuffer && nodejsUtils.isBuffer(input)) {
33973398
return "nodebuffer";
33983399
}
3399-
if (support.uint8array && input instanceof Uint8Array) {
3400+
if (support.uint8array && proto === "[object Uint8Array]") {
34003401
return "uint8array";
34013402
}
3402-
if (support.arraybuffer && input instanceof ArrayBuffer) {
3403+
if (support.arraybuffer && proto === "[object ArrayBuffer]") {
34033404
return "arraybuffer";
34043405
}
34053406
};
@@ -3492,21 +3493,29 @@ exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinarySt
34923493

34933494
var isBlob = support.blob && (data instanceof Blob || ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(data)) !== -1);
34943495

3495-
if (isBlob && typeof FileReader !== "undefined") {
3496-
return new external.Promise(function (resolve, reject) {
3497-
var reader = new FileReader();
3498-
3499-
reader.onload = function(e) {
3500-
resolve(e.target.result);
3501-
};
3502-
reader.onerror = function(e) {
3503-
reject(e.target.error);
3504-
};
3505-
reader.readAsArrayBuffer(data);
3506-
});
3507-
} else {
3508-
return data;
3496+
if (isBlob) {
3497+
if (typeof Blob.prototype.arrayBuffer !== "undefined") {
3498+
return data.arrayBuffer();
3499+
} else if (typeof FileReader !== "undefined") {
3500+
return new external.Promise(function (resolve, reject) {
3501+
var reader = new FileReader();
3502+
3503+
reader.onload = function(e) {
3504+
resolve(e.target.result);
3505+
};
3506+
reader.onerror = function(e) {
3507+
reject(e.target.error);
3508+
};
3509+
reader.readAsArrayBuffer(data);
3510+
});
3511+
} else {
3512+
return external.Promise.reject(
3513+
new Error(name + " is a Blob, but we have no way of reading it.")
3514+
);
3515+
}
35093516
}
3517+
3518+
return data;
35103519
});
35113520

35123521
return promise.then(function(data) {

‎dist/jszip.min.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</div>
1414
<div class="col-md-7">
1515
<p>
16-
<strong>Current version</strong> : v3.10.1
16+
<strong>Current version</strong> : v3.10.2
1717
</p>
1818
<p>
1919
<strong>License</strong> : JSZip is dual-licensed. You may use it under the

‎lib/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ JSZip.defaults = require("./defaults");
4545

4646
// TODO find a better way to handle this version,
4747
// a require('package.json').version doesn't work with webpack, see #327
48-
JSZip.version = "3.10.1";
48+
JSZip.version = "3.10.2";
4949

5050
JSZip.loadAsync = function (content, options) {
5151
return new JSZip().loadAsync(content, options);

‎package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jszip",
3-
"version": "3.10.1",
3+
"version": "3.10.2",
44
"author": "Stuart Knightley <stuart@stuartk.com>",
55
"description": "Create, read and edit .zip files with JavaScript http://stuartk.com/jszip",
66
"scripts": {

0 commit comments

Comments
 (0)