1
1
mirror of https://github.com/wader/fq.git synced 2024-11-25 23:13:19 +03:00
fq/format/zip/testdata/help_zip.fqtest
Mattias Wadman a83cac6021 zip: Fix incorrect time/date, add extended timestamp and refactor
MSDOS time/date was read in wrong order and also did not take into account
that the bit ranges in the shortis are in little-endian.

Remodel modification_time/date to be one struct with fat_time, fat_date LE shorts
and then synthetic values for day, hours, minute etc and also a unix field with the
timestamp as unix time.

Also refactor and clenaup extra fields/extended code a bit.

Fixes #792
2023-10-23 11:11:27 +02:00

36 lines
1.1 KiB
Plaintext

$ fq -h zip
zip: ZIP archive decoder
Options
=======
uncompress=true Uncompress and probe files
Decode examples
===============
# Decode file as zip
$ fq -d zip . file
# Decode value as zip
... | zip
# Decode file using zip options
$ fq -d zip -o uncompress=true . file
# Decode value as zip
... | zip({uncompress:true})
Supports ZIP64.
Timestamp and time zones
========================
The timestamp accessed via .local_files[].last_modification is encoded in ZIP files using MS-DOS representation
(https://learn.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-dosdatetimetovarianttime) which lacks a known time zone.
Probably the local time/date was used at creation. The unix_guess field in last_modification is a guess assuming the local time zone
was UTC at creation.
References
==========
- https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
- https://opensource.apple.com/source/zip/zip-6/unzip/unzip/proginfo/extra.fld
- https://formats.kaitai.io/dos_datetime/
- https://learn.microsoft.com/en-us/windows/win32/api/oleauto/nf-oleauto-dosdatetimetovarianttime