# s2mod-packer
**Pack/unpack `.s2mod` Content Pack archives for [OpenStranded](https://github.com/OpenStranded/s2mod-tool).**
[Documentation](https://docs.rs/s2mod-packer) |
[Crate](https://crates.io/crates/s2mod-packer)
## Usage
### CLI
```text
s2mod-packer <command> [options]
Commands:
pack Pack a directory into a .s2mod archive
unpack Unpack a .s2mod archive to a directory
info Show information about a .s2mod archive
```
#### Examples
```sh
# Pack
s2mod-packer pack ./my_mod_dir/ ./output.s2mod
# Unpack
s2mod-packer unpack ./pack.s2mod ./output_dir/
# Info
s2mod-packer info ./pack.s2mod
```
### Library
```toml
[dependencies]
s2mod-packer = "0.1"
```
```rust
use s2mod_packer::{S2ModPackage, ContentPackManifest};
// Read an existing pack
let mut pack = S2ModPackage::open("pack.s2mod")?;
println!("Pack: {}", pack.manifest().pack.name);
// Create a new pack
let manifest = ContentPackManifest::new("my_mod", "My Mod");
let mut pack = S2ModPackage::create("my_mod.s2mod", manifest)?;
pack.add_file("manifest.toml", &toml_bytes)?;
pack.finalize()?;
```
### Modules
| `manifest` | Content Pack manifest (`manifest.toml`) |
| `package` | Archive read/write operations |
| `cli` | Command-line interface |
## License
GPL-3.0-or-later. See [`LICENSE`](LICENSE) and [`NOTICE`](NOTICE).