-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
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.
} | ||
|
||
return extFileAttr; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fun stuff :)
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,
unixPermissions
anddosPermissions
, 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.