#archive #ultra #password #game #tokio #hpa

hyper-archive

HPA | Ultra Fast Archive compression method for games and many other

13 releases

0.3.0 Mar 3, 2025
0.2.1 Feb 26, 2025
0.1.171 Feb 16, 2025

#134 in Compression

Download history 639/week @ 2025-02-15 355/week @ 2025-02-22 212/week @ 2025-03-01 12/week @ 2025-03-08

1,218 downloads per month

MIT license

19KB
294 lines

HyperArchive: Ultra fast compressed real-time archive method

You need TOKIO to run HPA format (HPA is an Async Archive)

IF YOU'RE SWITCHING FROM VERSION 0.1.X I HIGHLY RECOMMAND YOU TO EXPORT YOUR HPA FILE, THERES NO UPDATER IN VERSION 0.2.X

Usage example::

use tokio;
use hyper_archive;

#[tokio::main]
async fn main() {
    set_password("password").await; // Set password for AES-256
    set_compression_algorithm(lib::Algorithms::Algorithm_You_Prefer).await; // To chose algorithm

    hyper_archive::write_structure("your_file", "hpa_file", /* encrypt (True or False) */).await.unwrap(); // Creates an HPA file and writes data inside
    let your_variable_name = hyper_archive::read_structure("your_fil_name_and_extension", "hpa_file", /* is encrypted (True or False) */).await.unwrap(); // Reading data block and returns data, and you don't have to use let, you can dump in file or whatever
    hyper_archive::add_structure("your_file", "hpa_file", /* encrypt (True or False) */).await.unwrap(); // Adding data block to HPA file
    hyper_archive::remove_structure("your_fil_name_and_extension", "hpa_file", /* is encrypted (True or False) */).await.unwrap(); // Removing data block from HPA file
    hyper_archive::update_structure("your_file", "hpa_file", /* is encrypted (True or False) */).await.unwrap(); // Updates data block in HPA file
    hyper_archive::export_structure("your_file", "hpa_file", "export_file_name", /* is encrypted (True or False) */).await.unwrap(); // Exports data block in HPA file

    // I don't recommand you to use unwrap.
    // Not: When you're calling a hpa you have to enter extension: test.txt -> test.txt
    // If you want you can use with tokio::spawn / tokio::task::spawn / ... Example:

    let return_data = tokio::spawn(async {
        hyper_archive::read_structure("your_file_name_and_extension", "hpa_file").await.unwrap()
    }).await.unwrap();

    println!("{:?}", return_data); // It won't really work but still will be in Async
}

Which case you should use HPA?:

  1. When you use a File, and it's too big, you can use HPA at ease (File shouldn't be compressed before, if it is compressed file size may can be increased and in extreme case scenario file can be broke)
  2. When you need compression and speed (Still file shouldn't be compressed)
  3. In any case scenario (Yeah you can develop a game with HPA, but I don't recommend personally because adding every file by hand in HPA will be like and its speed won't be good as native. And of course some files may not work)

VERSION 0.3:

  1. Error handling
  2. Now you can switch between ZSTD and LZ4
  3. Faster respond times
  4. Overall improvements

Dependencies

~8–15MB
~183K SLoC