#archive #decompression #gcpf

bin+lib rpgcpf

GCPF archive compression and decompression library

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

CC0 license

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 the brotli crate
  • deflate: enables the deflate comression mode, depends on the flate2 crate
  • fastlz: enables the fastlz comression mode, depends on the fastlz-rs crate
  • gzip: enables the gzip comression mode, depends on the flate2 crate
  • zstd: enables the zstd comression mode, depends on the zstd crate
  • cli: enables the command line binary, and adds clap derives to the Gcpf struct. Depends on the clap, patharg, anyhow, and humanize-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