Closed michalzaq12 closed 1 year ago
It's possible via the the versionMadeBy
and the externalFileAttribute
options, see resp. 4.4.2 and 4.4.15 here https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.9.TXT. I don't yet where to find a reliable source to get more details on how to set the externalFileAttribute
value properly.
Thanks for your reply, the attributes don't seem to be set correctly.
My code in NodeJS
const data = fs.createReadStream('./in.zip');
const zipFs = new zipFsNamespace.FS();
await zipFs.importReadable(Readable.toWeb(data));
const exeEntry = zipFs.find('executable');
console.log('file attr:', exeEntry.data.externalFileAttribute) // file attr: 2179792896
const outStream = fs.createWriteStream('./out.zip');
zipFs.exportWritable(Writable.toWeb(outStream));
Once exported, the "executable" file can no longer be run.
Moreover, if I import the file 'out.zip' and read externalFileAttribute
again, it is zero.
This issue also occurs on: https://gildas-lormeau.github.io/zipjs-react-app/
The application “Table Tool 2” can’t be opened.
(due to lack of proper permissions)The FS
API is still a bit limited and does not provide a way to copy these metadata yet. However, you should be able to read and write the versionMadeBy
and the externalFileAttribute
properties/options when using the ZipReader
/ZipWriter
APIs.
I did not say I would not implement this feature request.
This should be fixed in the version 2.6.81
I just published.
Does this library support storing permissions? Something similar to: https://stuk.github.io/jszip/documentation/api_jszip/file_data.html#unixpermissions-and-dospermissions-options.
Unfortunately, this is a big problem when there are e.g. OSX applications in the zip, you need to grant them execute permissions.