Add support for UNIX / DOS permissions - #200
Conversation
Two new fields on ZipObject, `unixPermissions` and `dosPermissions`, hold the UNIX or DOS permissions of the file. A new option of `generate()`, `platform` (DOS or UNIX) controls the use of the permissions. The default behavior is to generate DOS archives, without any permissions, like before. Bonus side-effect : Finder on mac doesn't use the DOS directory flag, JSZip didn't properly recognize folders until now. Fix Stuk#194 and Stuk#198.
|
Wow, great work. |
Add support for UNIX / DOS permissions
|
Thanks ! |
|
I chose simplified permissions (readOnly/executable/etc versus the full unix/dos permissions/mode) for two reasons :
Unfortunately, this simplification may hurt too many nodejs users. If they compress a The best solution may be to replace the Does that sounds good to you @Stuk ? We also lack an options parameter on |
This is an update for Stuk#200. If we don't keep the original unix/dos permissions, this will lead to hard-to-debug issues, where the permissions are not exactly like they were specified. This commit changes that and uses the exact file mode. It also updates the default umask from 022 to 002 (with unixPermissions == null, files will get 0664 and folders 0775). To put a folder with custom permissions, folder() is not a good candidate : its behavior is to re-use existing entries. Instead, this commit documents the existing dir attribute.
Two new fields on ZipObject,
unixPermissionsanddosPermissions, hold theUNIX or DOS permissions of the file. A new option of
generate(),platform(DOS or UNIX) controls the use of the permissions.The default behavior is to generate DOS archives, without any
permissions, like before.
Bonus side-effect : Finder on mac doesn't use the DOS directory flag,
JSZip didn't properly recognize folders until now.
Fix #194 and #198.