1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00
Files
jc/docs/parsers/zipinfo.md

105 lines
2.4 KiB
Markdown
Raw Normal View History

2021-12-21 12:14:20 -08:00
[Home](https://kellyjonbrazil.github.io/jc/)
2022-01-25 17:07:47 -08:00
<a id="jc.parsers.zipinfo"></a>
2021-12-21 12:14:20 -08:00
# jc.parsers.zipinfo
2022-01-25 17:07:47 -08:00
2022-03-04 13:27:39 -08:00
jc - JSON Convert `zipinfo` command output parser
2021-12-21 12:14:20 -08:00
2022-05-26 15:54:39 -07:00
> Note: No `zipinfo` options are supported.
2021-12-21 12:14:20 -08:00
Usage (cli):
2022-01-25 18:03:34 -08:00
$ zipinfo <archive> | jc --zipinfo
2021-12-21 12:14:20 -08:00
2022-08-15 13:51:48 -07:00
or
2021-12-21 12:14:20 -08:00
2022-01-25 18:03:34 -08:00
$ jc zipinfo
2021-12-21 12:14:20 -08:00
Usage (module):
2022-01-25 18:03:34 -08:00
import jc
result = jc.parse('zipinfo', zipinfo_command_output)
2022-01-18 15:38:03 -08:00
2021-12-21 12:14:20 -08:00
Schema:
2021-12-21 13:42:24 -08:00
2022-01-25 18:03:34 -08:00
[
{
"archive": string,
"size": integer,
"size_unit": string,
"number_entries": integer,
"number_files": integer,
"bytes_uncompressed": integer,
"bytes_compressed": integer,
"percent_compressed": float,
"files": [
{
"flags": string,
"zipversion": string,
2022-02-01 17:57:12 -08:00
"zipunder": string,
2022-01-25 18:03:34 -08:00
"filesize": integer,
"type": string,
"method": string,
"date": string,
"time": string,
"filename": string
}
]
}
]
Examples:
$ zipinfo log4j-core-2.16.0.jar | jc --zipinfo -p
[
{
"archive": "log4j-core-2.16.0.jar",
"size": 1789565,
"size_unit": "bytes",
"number_entries": 1218,
"number_files": 1218,
"bytes_uncompressed": 3974141,
"bytes_compressed": 1515455,
"percent_compressed": 61.9,
"files": [
{
"flags": "-rw-r--r--",
"zipversion": "2.0",
"zipunder": "unx",
"filesize": 19810,
"type": "bl",
"method": "defN",
"date": "21-Dec-12",
"time": "23:35",
"filename": "META-INF/MANIFEST.MF"
},
...
2022-01-25 17:07:47 -08:00
<a id="jc.parsers.zipinfo.parse"></a>
2022-03-05 12:15:14 -08:00
### parse
2022-01-25 17:07:47 -08:00
2021-12-21 12:14:20 -08:00
```python
2022-01-25 17:07:47 -08:00
def parse(data, raw=False, quiet=False)
2021-12-21 12:14:20 -08:00
```
Main text parsing function
2022-01-25 18:03:34 -08:00
Parameters:
2021-12-21 12:14:20 -08:00
2022-01-25 18:03:34 -08:00
data: (string) text data to parse
raw: (boolean) unprocessed output if True
quiet: (boolean) suppress warning messages if True
2021-12-21 12:14:20 -08:00
2022-01-25 18:03:34 -08:00
Returns:
2021-12-21 12:14:20 -08:00
2022-01-25 18:03:34 -08:00
List of Dictionaries. Raw or processed structured data.
2021-12-21 12:14:20 -08:00
2022-01-25 19:18:54 -08:00
### Parser Information
2021-12-21 12:14:20 -08:00
Compatibility: linux, darwin
2023-12-21 14:55:21 -08:00
Source: [`jc/parsers/zipinfo.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/zipinfo.py)
2023-01-05 12:00:20 -08:00
Version 1.2 by Matt J (https://github.com/listuser)