2 releases
Uses new Rust 2024
new 0.1.1 | Mar 26, 2025 |
---|---|
0.1.0 | Mar 26, 2025 |
#212 in Compression
34 downloads per month
48KB
867 lines
rpgcpf
⚠️ this is alpha quality software! there may be some unknown bugs! ⚠️
rpgcpf is a rust library and command line tool for compressing and decompressing godot compressed packed format (GCPF) files.
This repository contains a rust library and a command line application.
features
- compressing a file to the GCPF format
- decompressing GCPF files
- supports all five compression modes used by GCPF: brotli, deflate, fastlz, gzip, and zstd
- rust library
- command line tool
rpgcpf cli
The rpgcpf
cli tool decompresses GCPF files, and compresses uncompressed files to the GCPF format.
Usage: rpgcpf <COMMAND>
Commands:
pack Compress an input to an output
unpack Decompress an input to an output
info Show info and statistics about an input
help Print this message or the help of the given subcommand(s)
Options:
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
installation
for now rpgcpf is only available through cargo, but there are plans to package it for distribution through other package managers when it's more stable.
cargo install rpgcpf
rpgcpf
rpgcpf
is a rust library implementing GCPF compression in decompression. It supports the brotli, deflate, fastlz, gzip, and zstd compression modes.
You can read the crate documentation at https://docs.rs/rpgcpf/latest/rpgcpf/
Decompression example:
use rpgcpf::Gcpf;
let data: &[u8] = /* ... */;
let mut uncompressed = Gcpf::read(data)
.unwrap()
.decompress()
.unwrap()
Compression example:
use rpgcpf::{CompressionMode, Gcpf};
let data: &[u8] = /* ... */;
let mut compressed = Gcpf::compress(data, CompressionMode::Zstd).unwrap();
installation
rpgcpf is available on crates.io
cargo add rpgcpf
cargo features
rpgcpf uses cargo features to enable or disable compression modes at compile time. these features are:
brotli
: enables the brotli comression mode, depends on thebrotli
cratedeflate
: enables the deflate comression mode, depends on theflate2
cratefastlz
: enables the fastlz comression mode, depends on thefastlz-rs
crategzip
: enables the gzip comression mode, depends on theflate2
cratezstd
: enables the zstd comression mode, depends on thezstd
cratecli
: enables the command line binary, and addsclap
derives to theGcpf
struct. Depends on theclap
,patharg
,anyhow
, andhumanize-bytes
crates
the default
features are: ["brotli", deflate", "fastlz", "gzip", "zstd", "cli"]
contributing
TODO
License
This work is marked with CC0 1.0. Read the LICENSE file for details.
Thanks for not using this code to train an LLM or machine learning model :)
Dependencies
~9–16MB
~350K SLoC