Commit graph

29 commits

Author SHA1 Message Date
Chris Hennick
eacc320fe0
chore: Add check for wrong-length blocks, and incorporate fixed-size requirement into the trait name 2024-06-02 21:48:21 -07:00
Alex Franchuk
a8875b0226
feat: Allow the archive offset behavior of the reader to be configured.
Aside from supporting the current behavior which allows archives to be
preceded by arbitrary data (added in fc749a09), this also allows
detection of the offset to use by checking whether a central directory
header is at the expected location. This is configurable because if the
behavior were based only on detection, there could be false positives if
archive data happened to contain a central directory header at the right
spot.
2024-05-29 13:59:20 -04:00
Danny McClanahan
8fbc4039a8
lean more on the ::MAGIC trait constants 2024-05-24 07:54:04 -04:00
Danny McClanahan
ea308499af
bulk parsing and bulk writing
- use blocks for reading individual file headers
- remove unnecessary option wrapping for stream entries
- create Block trait
- add coerce method to reduce some boilerplate
- add serialize method to reduce more boilerplate
- use to_le! and from_le!
- add test case
- add some docs
- rename a few structs to clarify zip32-only
2024-05-24 07:52:25 -04:00
Chris Hennick
84ae5fc157
refactor: Remove byteorder dependency (#83) 2024-05-02 17:50:27 -07:00
Brett Simons
24f4b98ae4
Update stream.rs to use the is_dir function instead of explicitly checking ZipFile name 2024-04-30 09:05:17 -07:00
Chris Hennick
64b738a81e
chore(release): revert method deletions from c9cb506bc9 2024-04-22 19:46:32 -07:00
Chris Hennick
c9cb506bc9
Update docs, remove some deprecated methods, and substitute crate version into docstring 2024-04-22 17:23:44 -07:00
Chris Hennick
9438bef0f7 Replace AtomicU64 with OnceLock 2024-04-14 07:53:32 -07:00
Chris Hennick
4f3f2d1fca Bug fix: LZMA state is large, so put it in a Box 2024-04-11 13:28:37 -07:00
Chris Hennick
7f8311efea Add support for decompressing LZMA 2024-04-11 13:03:57 -07:00
Chris Hennick
384afcda2a Switch from String to Box<str> for metadata 2024-04-08 10:29:17 -07:00
Chris Hennick
da21bbe45f Remove redundant imports 2024-02-28 16:03:44 -08:00
Chris Hennick
3cb826fe8b
Make functions const where possible 2023-06-07 22:15:06 -07:00
Chris Hennick
46333b2d61
Fix Clippy warning: rev().next() -> next_back() 2023-05-21 11:39:22 -07:00
Marli Frost
c4c6ec9e7c fix: clippy 2023-02-01 18:03:03 +00:00
Marli Frost
d06d4b295f refactor: move the new ZipStreamReader API to the unstable module 2023-02-01 17:55:07 +00:00
Marli Frost
1eb491e96e fix: clippy lint 2023-02-01 17:39:10 +00:00
Jiahao XU
e322842bfd Fix clippy warning in stream.rs:85
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
f97f017d99 Rm read::stream::test::zip_contents
As streaming mode cannot calculate central_header_start.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
89ff32d93b Rm infesible guarantee in ZipStreamVisitor::visit_additional_metadata
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
ef1846e121 Rm stream::tests::zip64_with_leading_junk
As in streaming mode, there is no way to ignore the leading junk.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
b944bee72d Add unit tests for mod read::streams
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
c6fe396b56 Impl ZipStreamFileMetadata::is_{dir, file}
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
d858994e1e Add guarantee for ZipStreamVisitor::visit_additional_metadata
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
8f7c43c227 Rm unnecessary p.exist() check in ZipStreamReader::extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
5b6d9557c6 Impl ZipStreamReader::extract
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
42e2865ccb derive(Debug) for ZipStreamFileMetadata
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00
Jiahao XU
02c3699be2 Impl new mod read::stream
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-01 17:33:35 +00:00