AI prompts
base on ZIP format implementation in Rust, sans-io [![MIT OR Apache-2.0 licensed](https://img.shields.io/badge/license-MIT+Apache_2.0-blue.svg)](./LICENSE)
[![Crates.io](https://img.shields.io/crates/v/rc-zip)](https://crates.io/crates/rc-zip)
[![docs.rs](https://docs.rs/rc-zip/badge.svg)](https://docs.rs/rc-zip)
# rc-zip
![The rc-zip logo: a person with long hair and nice brows being opened from the bottom up with a zipper. On dark backgrounds, you can see a skull being revealed. On light backgrounds you cannot.](https://github.com/user-attachments/assets/5fecd286-9518-4a72-b544-56675d7f31f6)
_Logo by [MisiasArt](https://misiasart.com)_
### Motivation
Have a pure rust, highly compatible, I/O-model-independent, zip reading and
writing library.
(Note: as of now, rc-zip does reading only)
### Funding
Thanks to these companies for contracting work on rc-zip:
<a href="https://rowzero.io"><img src="./static/rowzero-e.svg" height="40"></a>
And thanks to all my [individual sponsors](https://fasterthanli.me/donate).
### Design decisions
The core of this crate does not perform I/O directly. Instead, it uses a state
machine, and asks for reads at specific offsets. This allows it to work under
different I/O models: blocking, non-blocking, and async. It has no expectations
of the zip archive being present on disk (ie. it doesn't assume `std::fs`), just
that random access is possible.
The recommended interface relies on the central directory rather than local headers:
```
[local file header 1] // <---------------- ignored
[file data 1]
[local file header 2]
[file data 2]
[central directory header 1] // <--------- used
[central directory header 2]
[end of central directory record]
```
The reason for that is that the central directory is the canonical list of
entries in a zip. Archives that have been repacked may contain duplicate local
file headers (and data), along with headers for entries that have been removed.
Only the central directory is authoritative when it comes to the contents of a
zip archive.
However, as of v4.0.0, a streaming decompression interface was added to both
`rc-zip-sync` and `rc-zip-tokio`, in the form of the `ReadZipStreaming` traits.
This crate accepts what is known as "trailing zips" - for example, files that
are valid ELF or PE executables, and merely have a valid zip archive appended.
This covers some forms of self-extracting archives and installers.
This crate recognizes and uses zip64 metadata. This allows for a large number
of entries (above 65536) and large entries (above 4GiB). This crate attempts to
forgives some non-standard behavior from common tools. Such behavior has been
observed in the wild and is, whenever possible, tested.
This crate attempts to recognize as much metadata as possible, and normalize
it. For example, MSDOS timestamps, NTFS timestamps, Extended timestamps and
Unix timestamps are supported, and they're all converted to a [chrono
DateTime<Utc>](https://crates.io/crates/chrono).
Although the normalized version of metadata (names, timestamps, UID, GID, etc.)
is put front and center, this crate attempts to expose a "raw" version of
that same metadata whenever the authors felt it was necessary.
Whenever the zip archive doesn't explicitly specify UTF-8 encoding, this crate
relies on encoding detection to decide between CP-437 and Shift-JIS. It uses
[encoding_rs](https://crates.io/crates/encoding_rs) to deal with Shift-JIS.
Due to the history of the zip format, some compatibility issues are to be
expected: for example, for archives with only MSDOS timestamps, the results
might be in the wrong timezone. For archive with very few files and non-UTF8
names, the encoding might not be detected properly, and thus decoding may fail.
As much as possible, [winnow](https://crates.io/crates/winnow) is used to parse the
various data structures used in the zip archive format. This allows a
semi-declarative style that is easier to write, read, and amend if needed.
Some (hygienic) macros are used to avoid repetition.
### API design
The design of the API is constrained by several parameters:
* A compliant zip reader *must* first read the central directory, located
near the end of the zip archive. This means simply taking an `Read` won't do.
* Multiple I/O models must be supported. Whereas other crates focus on
taking a `Read`, a `Read + Seek`, or simply a byte slice, this crate aims
to support synchronous *and* asynchronous I/O.
* Not everyone wants a compliant zip reader. Some may want to rely on local
headers instead, completely ignoring the central directory, thus throwing
caution to the wind.
As a result, the structs in this crate are state machines, that advertise their
need to read (and from where), to process data, or to write. I/O errors are
cleanly separated from the rest, and calls to this crate never block.
Separate crates add specific I/O models on top of rc-zip, see the [rc-zip-sync](https://crates.io/crates/rc-zip-sync)
and [rc-zip-tokio](https://crates.io/crates/rc-zip-tokio) crates.
## License
This project is primarily distributed under the terms of both the MIT license
and the Apache License (Version 2.0).
See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for details.
", Assign "at most 3 tags" to the expected json: {"id":"7631","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"