Skip to content

Add an options parameter to folder() - #967

Open
patrickkettner wants to merge 2 commits into
Stuk:mainfrom
patrickkettner:folder-options
Open

Add an options parameter to folder()#967
patrickkettner wants to merge 2 commits into
Stuk:mainfrom
patrickkettner:folder-options

Conversation

@patrickkettner

Copy link
Copy Markdown

Fixes #341

folder(name, options) accepts the same options as file() (permissions, date, comment...). As discussed in the issue, the options only apply to the specified folder, not to the automatically created parent folders: zip.folder("a/b", options) behaves like zip.folder("a").folder("b", options). Options on an already existing folder are still ignored, the existing test pins that too. Docs and index.d.ts are updated.

The first commit fixes a build problem this PR would otherwise trip over: the browser field in package.json redirects ./lib/index to ./dist/jszip.min.js, so grunt build bundles the previously released code instead of lib/, and the browser tests run against that old bundle (the new tests here fail without it, verified on chromium and firefox). With browserField: false the build bundles the current sources and all 3314 browser tests pass. Two side effects to know about before a release build uses this: the unminified bundle grows (~374KB to ~463KB) because the real readable-stream is bundled instead of lib/readable-stream-browser.js, and JSZip.support.nodestream becomes true in the browser bundle. Happy to split that commit into its own PR if preferred.

dist/ is untouched, as it only changes in release commits.

package.json maps ./lib/index to ./dist/jszip.min.js for bundlers, so
browserify wrapped the previously released bundle instead of building
lib/. The browser tests were testing the old code.
folder(name, options) accepts the same options as file() (permissions,
date, comment...). The options only apply to the specified folder, not
to the automatically created parent folders.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set dosPermissions/unixPermissions on folder creation

1 participant