Skip to content

Commit 2b6a435

Browse files
armijnhemelfolkertdev
authored andcommitted
add an example for a streamed ZIP file
1 parent 92aaf7a commit 2b6a435

File tree

3 files changed

+157
-0
lines changed

3 files changed

+157
-0
lines changed

testdata/readme.streamingzip

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
To create a file without a name using ZIP streaming:
2+
3+
$ echo "bla" | zip -r streaming.zip -
4+
adding: - (stored 0%)
5+
6+
$ file streaming.zip
7+
streaming.zip: Zip archive data, at least v4.5 to extract, compression method=store
8+
9+
$ unzip -l streaming.zip
10+
Archive: streaming.zip
11+
Length Date Time Name
12+
--------- ---------- ----- ----
13+
4 06-27-2025 15:25 -
14+
--------- -------
15+
4 1 file

testdata/streaming.zip

200 Bytes
Binary file not shown.
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
source: ziplinter/src/lib.rs
3+
expression: result
4+
---
5+
{
6+
"comment": "",
7+
"contents": [
8+
{
9+
"central": {
10+
"comment": "",
11+
"compressed_size": 4,
12+
"crc32": 1838506280,
13+
"creator_version": {
14+
"host_system": "Unix",
15+
"version": 30
16+
},
17+
"disk_nbr_start": 0,
18+
"external_attrs": 293601280,
19+
"extra": [],
20+
"flags": 0,
21+
"header_offset": 0,
22+
"internal_attrs": 1,
23+
"method": "Store",
24+
"mode": 33554816,
25+
"modified": "2025-06-27T15:25:46Z",
26+
"name": "-",
27+
"reader_version": {
28+
"host_system": "MsDos",
29+
"version": 45
30+
},
31+
"uncompressed_size": 4
32+
},
33+
"local": {
34+
"accessed": null,
35+
"compressed_size": 4,
36+
"crc32": 1838506280,
37+
"created": null,
38+
"extra": [
39+
1,
40+
0,
41+
16,
42+
0,
43+
4,
44+
0,
45+
0,
46+
0,
47+
0,
48+
0,
49+
0,
50+
0,
51+
4,
52+
0,
53+
0,
54+
0,
55+
0,
56+
0,
57+
0,
58+
0
59+
],
60+
"flags": 0,
61+
"gid": null,
62+
"header_offset": 0,
63+
"method": "Store",
64+
"method_specific": "None",
65+
"mode": 0,
66+
"modified": "2025-06-27T15:25:46Z",
67+
"name": "-",
68+
"reader_version": {
69+
"host_system": "MsDos",
70+
"version": 45
71+
},
72+
"uid": null,
73+
"uncompressed_size": 4
74+
}
75+
}
76+
],
77+
"encoding": "Utf8",
78+
"eocd": {
79+
"dir": {
80+
"inner": {
81+
"dir_disk_nbr": 0,
82+
"dir_records_this_disk": 1,
83+
"directory_offset": 55,
84+
"directory_records": 1,
85+
"directory_size": 47,
86+
"disk_nbr": 0
87+
},
88+
"offset": 178
89+
},
90+
"dir64": {
91+
"inner": {
92+
"creator_version": 798,
93+
"dir_disk_nbr": 0,
94+
"dir_records_this_disk": 1,
95+
"directory_offset": 55,
96+
"directory_records": 1,
97+
"directory_size": 47,
98+
"disk_nbr": 0,
99+
"reader_version": 45,
100+
"record_size": 44
101+
},
102+
"offset": 102
103+
},
104+
"global_offset": 0
105+
},
106+
"parsed_ranges": [
107+
{
108+
"contains": "end of central directory record",
109+
"end": 200,
110+
"start": 178
111+
},
112+
{
113+
"contains": "zip64 end of central directory locator",
114+
"end": 178,
115+
"start": 158
116+
},
117+
{
118+
"contains": "zip64 end of central directory record",
119+
"end": 158,
120+
"start": 102
121+
},
122+
{
123+
"contains": "central directory header",
124+
"end": 102,
125+
"filename": "-",
126+
"start": 55
127+
},
128+
{
129+
"contains": "local file header",
130+
"end": 51,
131+
"filename": "-",
132+
"start": 0
133+
},
134+
{
135+
"contains": "file data",
136+
"end": 55,
137+
"filename": "-",
138+
"start": 51
139+
}
140+
],
141+
"size": 200
142+
}

0 commit comments

Comments
 (0)