Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Stuk/jszip
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.1.3
Choose a base ref
...
head repository: Stuk/jszip
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.7.1
Choose a head ref
Loading
Showing with 7,551 additions and 2,305 deletions.
  1. +3 −2 .gitignore
  2. +2 −1 .jshintrc
  3. +1 −5 .travis.yml
  4. +54 −0 CHANGES.md
  5. +74 −131 Gruntfile.js
  6. +1 −1 README.markdown
  7. +1 −1 bower.json
  8. +16 −16 component.json
  9. +445 −466 dist/jszip.js
  10. +3 −5 dist/jszip.min.js
  11. +10 −9 documentation/_layouts/default.html
  12. +3 −7 documentation/api_jszip/constructor.md
  13. +1 −1 documentation/api_jszip/external.md
  14. +207 −45 documentation/api_jszip/file_data.md
  15. +9 −7 documentation/api_jszip/file_name.md
  16. +8 −13 documentation/api_jszip/file_regex.md
  17. +8 −10 documentation/api_jszip/filter.md
  18. +7 −9 documentation/api_jszip/{folder_data.md → folder_name.md}
  19. +8 −13 documentation/api_jszip/folder_regex.md
  20. +8 −10 documentation/api_jszip/for_each.md
  21. +154 −112 documentation/api_jszip/generate_async.md
  22. +8 −9 documentation/api_jszip/generate_internal_stream.md
  23. +8 −8 documentation/api_jszip/generate_node_stream.md
  24. +125 −33 documentation/api_jszip/load_async.md
  25. +7 −0 documentation/api_jszip/load_async_object.md
  26. +7 −12 documentation/api_jszip/remove.md
  27. +3 −1 documentation/api_jszip/version.md
  28. +9 −9 documentation/api_streamhelper/accumulate.md
  29. +15 −10 documentation/api_streamhelper/on.md
  30. +2 −6 documentation/api_streamhelper/pause.md
  31. +4 −6 documentation/api_streamhelper/resume.md
  32. +29 −0 documentation/api_zipobject.md
  33. +46 −18 documentation/api_zipobject/async.md
  34. +8 −8 documentation/api_zipobject/internal_stream.md
  35. +6 −8 documentation/api_zipobject/node_stream.md
  36. +14 −0 documentation/contributing.md
  37. +12 −0 documentation/css/main.css
  38. +2 −2 documentation/examples.md
  39. +77 −45 documentation/examples/download-zip-file.html
  40. +2 −0 documentation/examples/download-zip-file.inc/blob.html
  41. +10 −0 documentation/examples/download-zip-file.inc/blob.js
  42. +3 −0 documentation/examples/download-zip-file.inc/data_uri.html
  43. +10 −0 documentation/examples/download-zip-file.inc/data_uri.js
  44. +54 −39 documentation/examples/downloader.html
  45. +40 −0 documentation/examples/downloader.inc/downloader.html
  46. +58 −0 documentation/examples/downloader.inc/downloader.js
  47. +46 −0 documentation/examples/downloader.inc/helpers.js
  48. +0 −109 documentation/examples/downloader.js
  49. +84 −53 documentation/examples/get-binary-files-ajax.html
  50. +1 −0 documentation/examples/get-binary-files-ajax.inc/fetch_api.html
  51. +23 −0 documentation/examples/get-binary-files-ajax.inc/fetch_api.js
  52. +1 −0 documentation/examples/get-binary-files-ajax.inc/jszip_utils.html
  53. +27 −0 documentation/examples/get-binary-files-ajax.inc/jszip_utils.js
  54. +35 −52 documentation/examples/read-local-file-api.html
  55. +9 −0 documentation/examples/read-local-file-api.inc/read.html
  56. +44 −0 documentation/examples/read-local-file-api.inc/read.js
  57. +42 −2 documentation/faq.md
  58. +1 −1 documentation/howto/read_zip.md
  59. +2 −2 documentation/limitations.md
  60. +270 −0 index.d.ts
  61. +2 −2 index.html
  62. +16 −17 lib/compressedObject.js
  63. +0 −1 lib/crc32.js
  64. +29 −12 lib/flate.js
  65. +3 −3 lib/generate/ZipFileWorker.js
  66. +5 −2 lib/index.js
  67. +1 −1 lib/license_header.js
  68. +41 −42 lib/load.js
  69. +2 −2 lib/nodejs/NodejsStreamOutputAdapter.js
  70. +26 −3 lib/nodejsUtils.js
  71. +4 −4 lib/object.js
  72. +3 −3 lib/reader/DataReader.js
  73. +0 −2 lib/reader/readerFor.js
  74. +6 −13 lib/stream/StreamHelper.js
  75. +1 −1 lib/support.js
  76. +1 −1 lib/utf8.js
  77. +20 −22 lib/utils.js
  78. +7 −7 lib/zipEntries.js
  79. +4 −2 lib/zipEntry.js
  80. +21 −12 lib/zipObject.js
  81. +4,310 −0 package-lock.json
  82. +18 −19 package.json
  83. +4 −5 test/asserts/constructor.js
  84. +34 −35 test/asserts/delete.js
  85. +5 −6 test/asserts/deprecated.js
  86. +12 −13 test/asserts/external.js
  87. +262 −256 test/asserts/file.js
  88. +15 −18 test/asserts/filter.js
  89. +5 −6 test/asserts/foreach.js
  90. +94 −95 test/asserts/generate.js
  91. +300 −246 test/asserts/load.js
  92. +21 −22 test/asserts/permissions.js
  93. +44 −29 test/asserts/stream.js
  94. +42 −46 test/asserts/unicode.js
  95. +2 −3 test/asserts/version.js
  96. +1 −30 test/helpers/node-test-utils.js
  97. +23 −25 test/helpers/test-utils.js
  98. +0 −2 test/index.html
  99. BIN test/ref/extra_filed_non_standard.zip
  100. BIN test/ref/pollution.zip
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*~
.c9revisions
.DS_Store
node_modules
sauce_connect.log
.c9revisions
sauce_connect.log
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@

"globals": {
"TextEncoder": false,
"TextDecoder": false
"TextDecoder": false,
"self": true
},
"browser": true,
"node": true
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -4,11 +4,7 @@ matrix:
include:
- node_js: "stable"
env: COMMAND=lint
- node_js: "0.10"
env: COMMAND=test-node
- node_js: "0.12"
env: COMMAND=test-node
- node_js: "4.4"
- node_js: "lts/*"
env: COMMAND=test-node
- node_js: "stable"
env: COMMAND=test-node
54 changes: 54 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,60 @@ layout: default
section: main
---

### v3.7.1 2021-08-05

- Fix build of `dist` files.
+ Note: this version ensures the changes from 3.7.0 are actually included in the `dist` files. Thanks to Evan W for reporting.

### v3.7.0 2021-07-23

- Fix: Use a null prototype object for this.files (see [#766](https://github.com/Stuk/jszip/pull/766))
+ This change might break existing code if it uses prototype methods on the `.files` property of a zip object, for example `zip.files.toString()`. This approach is taken to prevent files in the zip overriding object methods that would exist on a normal object.

### v3.6.0 2021-02-09

- Fix: redirect main to dist on browsers (see [#742](https://github.com/Stuk/jszip/pull/742))
- Fix duplicate require DataLengthProbe, utils (see [#734](https://github.com/Stuk/jszip/pull/734))
- Fix small error in read_zip.md (see [#703](https://github.com/Stuk/jszip/pull/703))

### v3.5.0 2020-05-31

- Fix 'End of data reached' error when file extra field is invalid (see [#544](https://github.com/Stuk/jszip/pull/544)).
- Typescript definitions: Add null to return types of functions that may return null (see [#669](https://github.com/Stuk/jszip/pull/669)).
- Typescript definitions: Correct nodeStream's type (see [#682](https://github.com/Stuk/jszip/pull/682))
- Typescript definitions: Add string output type (see [#666](https://github.com/Stuk/jszip/pull/666))

### v3.4.0 2020-04-19

- Add Typescript type definitions (see [#601](https://github.com/Stuk/jszip/pull/601)).

### v3.3.0 2020-04-1

- Change browser module resolution to support Angular packager (see [#614](https://github.com/Stuk/jszip/pull/614)).

### v3.2.2 2019-07-04
- No public changes, but a number of testing dependencies have been updated.
- Tested browsers are now: Internet Explorer 11, Chrome (most recent) and Firefox (most recent). Other browsers (specifically Safari) are still supported however testing them on Saucelabs is broken and so they were removed from the test matrix.

### v3.2.1 2019-03-22
- Corrected built dist files

### v3.2.0 2019-02-21
- Update dependencies to reduce bundle size (see [#532](https://github.com/Stuk/jszip/pull/532)).
- Fix deprecated Buffer constructor usage and add safeguards (see [#506](https://github.com/Stuk/jszip/pull/506)).

### v3.1.5 2017-11-09
- Fix IE11 memory leak (see [#429](https://github.com/Stuk/jszip/pull/429)).
- Handle 2 nodejs deprecations (see [#459](https://github.com/Stuk/jszip/pull/459)).
- Improve the "unsupported format" error message (see [#461](https://github.com/Stuk/jszip/pull/461)).
- Improve webworker compatibility (see [#468](https://github.com/Stuk/jszip/pull/468)).
- Fix nodejs 0.10 compatibility (see [#480](https://github.com/Stuk/jszip/pull/480)).
- Improve the error without type in async() (see [#481](https://github.com/Stuk/jszip/pull/481)).

### v3.1.4 2017-08-24
- consistently use our own utils object for inheritance (see [#395](https://github.com/Stuk/jszip/pull/395)).
- lower the memory consumption in `generate*` with a lot of files (see [#449](https://github.com/Stuk/jszip/pull/449)).

### v3.1.3 2016-10-06
- instanceof failing in window / iframe contexts (see [#350](https://github.com/Stuk/jszip/pull/350)).
- remove a copy with blob output (see [#357](https://github.com/Stuk/jszip/pull/357)).
205 changes: 74 additions & 131 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,80 +1,16 @@
/*jshint node: true */
'use strict';
"use strict";

module.exports = function(grunt) {
// see https://saucelabs.com/rest/v1/info/browsers/webdriver
var browsers = [{
browserName: "iphone",
version: "7.0"
}, {
browserName: "iphone",
version: "9.2"
}, {
browserName: "android",
platform: "Linux",
version: "4.0"
}, {
browserName: "android",
platform: "Linux",
version: "4.4"
}, {
browserName: "android",
platform: "Linux",
version: "5.1"
}, {
browserName: "firefox",
platform: "Windows 10"
}, {
browserName: "chrome",
platform: "Windows 10"
}, {
browserName: "internet explorer",
platform: "XP",
version: "6"
}, {
browserName: "internet explorer",
platform: "XP",
version: "7"
}, {
browserName: "internet explorer",
platform: "Windows 7",
version: "8"
}, {
browserName: "internet explorer",
platform: "Windows 7",
version: "9"
}, {
browserName: "internet explorer",
platform: "Windows 8",
version: "10"
}, {
browserName: "internet explorer",
platform: "Windows 10",
version: "11"
}, {
browserName: "MicrosoftEdge",
platform: "Windows 10",
version: "13"
}, {
browserName: "opera",
platform: "Windows 2008",
version: "12"
}, {
browserName: "safari",
platform: "OS X 10.8",
version: "6"
}, {
browserName: "safari",
platform: "OS X 10.9",
version: "7"
}, {
browserName: "safari",
platform: "OS X 10.10",
version: "8"
}, {
browserName: "safari",
platform: "OS X 10.11",
version: "9"
}];
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator
// A lot of the browsers seem to time out with Saucelab's unit testing
// framework. Here are the browsers that work and get enough coverage for our
// needs.
var browsers = [
{browserName: "chrome"},
{browserName: "firefox", platform: "Linux"},
{browserName: "internet explorer"}
];

var tags = [];
if (process.env.TRAVIS_PULL_REQUEST && process.env.TRAVIS_PULL_REQUEST != "false") {
@@ -86,49 +22,52 @@ module.exports = function(grunt) {
var version = require("./package.json").version;

grunt.initConfig({
connect: {
server: {
options: {
base: "",
port: 9999
}
}
},
'saucelabs-qunit': {
all: {
options: {
urls: ["http://127.0.0.1:9999/test/index.html?hidepassed"],
build: process.env.TRAVIS_JOB_ID,
throttled: 3,
"max-duration" : 600, // seconds, IE6 is slow
browsers: browsers,
testname: "qunit tests",
tags: tags
}
}
},
jshint: {
// see https://github.com/gruntjs/grunt-contrib-jshint/issues/198
// we can't override the options using the jshintrc path
options: grunt.file.readJSON('.jshintrc'),
production: ['./lib/**/*.js'],
test: ['./test/helpers/**/*.js', './test/asserts/**/*.js'],
documentation: {
options: {
globals: {
jQuery: false,
JSZip: false,
JSZipUtils: false,
saveAs: false
},
// implied still give false positives in our case
strict: false
},
files: {
src: ['./documentation/**/*.js']
}
}
},
connect: {
server: {
options: {
base: "",
port: 8080
}
}
},
'saucelabs-qunit': {
all: {
options: {
urls: ["http://127.0.0.1:8080/test/index.html?hidepassed"],
build: process.env.TRAVIS_JOB_ID,
throttled: 4,
"max-duration": 1200, // seconds, IE6 is slow
browsers: browsers,
testname: "qunit tests",
tags: tags,
// Tests have statusCheckAttempts * pollInterval seconds to complete
pollInterval: 2000,
statusCheckAttempts: 240,
"max-duration": 1200,
browsers: browsers,
maxRetries: 2
}
}
},
jshint: {
// see https://github.com/gruntjs/grunt-contrib-jshint/issues/198
// we can't override the options using the jshintrc path
options: grunt.file.readJSON('.jshintrc'),
production: ['./lib/**/*.js'],
test: ['./test/helpers/**/*.js', './test/asserts/**/*.js'],
documentation: {
options: {
// we include js files with jekyll, jshint can't see all
// variables and we can't declare all of them
undef: false,
// 'implied' still give false positives in our case
strict: false
},
files: {
src: ['./documentation/**/*.js']
}
}
},
browserify: {
all: {
files: {
@@ -139,44 +78,48 @@ module.exports = function(grunt) {
standalone: 'JSZip',
transform: ['package-json-versionify'],
insertGlobalVars: {
process: undefined,
Buffer: undefined,
__filename: undefined,
__dirname: undefined
process: undefined,
Buffer: undefined,
__filename: undefined,
__dirname: undefined
},
builtins: false
},
banner : grunt.file.read('lib/license_header.js').replace(/__VERSION__/, version)
banner: grunt.file.read('lib/license_header.js').replace(/__VERSION__/, version)
}
}
},
uglify: {
options: {
mangle: true,
preserveComments: false,
banner : grunt.file.read('lib/license_header.js').replace(/__VERSION__/, version)
banner: grunt.file.read('lib/license_header.js').replace(/__VERSION__/, version)
},
all: {
src: 'dist/jszip.js',
dest: 'dist/jszip.min.js'
}
},
qunit: {
all: ['test/**/*.html']
}
});

grunt.loadNpmTasks("grunt-saucelabs");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.loadNpmTasks("grunt-saucelabs");
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-qunit');

// A task to cause Grunt to sit and wait, keeping the test server running
grunt.registerTask("wait", function() {
this.async();
});

grunt.registerTask("test-local", ["build", "connect", "wait"]);
grunt.registerTask("test-remote", ["build", "connect", "saucelabs-qunit"]);

if (process.env.SAUCE_USERNAME && process.env.SAUCE_ACCESS_KEY) {
grunt.registerTask("test", ["qunit", "connect", "saucelabs-qunit"]);
grunt.registerTask("test", ["jshint", "test-remote"]);
} else {
grunt.registerTask("test", ["qunit"]);
grunt.registerTask("test", ["jshint", "test-local"]);
}
grunt.registerTask("build", ["browserify", "uglify"]);
grunt.registerTask("default", ["jshint", "build"]);
2 changes: 1 addition & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ JSZip [![Build Status](https://api.travis-ci.org/Stuk/jszip.svg?branch=master)](

[![Selenium Test Status](https://saucelabs.com/browser-matrix/jszip.svg)](https://saucelabs.com/u/jszip)

A library for creating, reading and editing .zip files with Javascript, with a
A library for creating, reading and editing .zip files with JavaScript, with a
lovely and simple API.

See https://stuk.github.io/jszip for all the documentation.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
"authors": [
"Stuart Knightley <stuart@stuartk.com>"
],
"description": "Create, read and edit .zip files with Javascript http://stuartk.com/jszip",
"description": "Create, read and edit .zip files with JavaScript http://stuartk.com/jszip",
"main": "dist/jszip.js",
"keywords": [
"zip",
32 changes: 16 additions & 16 deletions component.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "jszip",
"repo": "Stuk/jszip",
"description": "Create, read and edit .zip files with Javascript http://stuartk.com/jszip",
"version": "3.1.3",
"keywords": [
"zip",
"deflate",
"inflate"
],
"main": "dist/jszip.js",
"license": "MIT or GPLv3",
"scripts": [
"dist/jszip.js"
]
}
{
"name": "jszip",
"repo": "Stuk/jszip",
"description": "Create, read and edit .zip files with JavaScript http://stuartk.com/jszip",
"version": "3.2.0",
"keywords": [
"zip",
"deflate",
"inflate"
],
"main": "dist/jszip.js",
"license": "MIT or GPLv3",
"scripts": [
"dist/jszip.js"
]
}
Loading