node-archiver
node-archiver copied to clipboard
--no-extra option for zip?
Hi all,
I was just wondering if there's any support for the '--no-extra' zip option? This option just excludes metadata from being included in the zip archive.
Useful for when you need to ensure the md5 sum is the same every time you generate a zip file with the same files.
Thanks,
Ben
what metadata does that exclude? I didnt think we set that much more than required for proper operation?
Here's the manpage entry, for your convenience:
-X, --no-extra Do not save extra file attributes (Extended Attributes on OS/2, uid/gid and file times on Unix). The zip format uses extra fields to include additional information for each entry. Some extra fields are specific to particular systems while others are applicable to all systems. Normally when zip reads entries from an existing archive, it reads the extra fields it knows, strips the rest, and adds the extra fields applicable to that system. With -X, zip strips all old fields and only includes the Unicode and Zip64 extra fields (currently these two extra fields cannot be disabled).
Negating this option, -X-, includes all the default extra fields, but also copies over any unrecognized extra fields.
I'm finding that I need this too.
With the --no-extra
option, zipping a mimetype
file along with my data allows Linux to guess the mimetype of the file. Without that option, it's not able to.
With -X
:
zip -X my-archive.zip mimetype datadirectory/*
file my-archive.zip
#> my-archive.zip: Zip data (MIME type "application/vnd.gingko.tree-document"?)
Without -X
:
zip my-archive.zip mimetype datadirectory/*
file my-archive.zip
#my-archive.zip: Zip archive data, at least v2.0 to extract
@bbrcan @AdrianoFerrari use something like this: archive.file('src.js', { date: '2018-10-19T06:54:32.953Z' })
, set the same date.
@bbrcan @AdrianoFerrari use something like this:
archive.file('src.js', { date: '2018-10-19T06:54:32.953Z' })
, set the same date.
It doesn't work. We may have to find another way.
Forcing the date doesn't work for me, either.
can someone help on this one?
I also have this problem. Every time generating files have different md5 sum. I need to remove the extra file attributes.
add option like
{
name: '123.txt',
date: new Date('2000-01-01T00:00:00')
}
it's work for me