Crates.io | zippylib |
lib.rs | zippylib |
version | 0.1.0 |
source | src |
created_at | 2024-02-03 23:41:22.168449 |
updated_at | 2024-02-03 23:41:22.168449 |
description | ZippyLib is a versatile Rust library designed for integrating file compression and decompression functionalities into Rust projects. |
homepage | |
repository | https://github.com/mm9942/zippylib |
max_upload_size | |
id | 1125745 |
size | 30,415 |
ZippyLib is a versatile Rust library designed for integrating file compression and decompression functionalities into Rust projects, supporting a wide array of formats: ZIP, TAR, TAR.GZ, TAR.XZ, TAR.BZ2, BZ2, XZ, GZ, Deflate, and Zlib. This guide provides straightforward API usage instructions to facilitate the inclusion of file compression and decompression capabilities.
Add ZippyLib to your Rust project by including it in your Cargo.toml
:
[dependencies]
zippylib = "^0.1"
or use:
cargo add zippylib
use zippylib::create_zip_archive;
use std::path::PathBuf;
let files = vec![PathBuf::from("file1.txt"), PathBuf::from("file2.txt")];
let output_path = PathBuf::from("archive.zip");
create_zip_archive(&files, output_path).expect("ZIP archive creation failed");
use zippylib::create_tar_archive;
use std::path::PathBuf;
let files = vec![PathBuf::from("file1.txt"), PathBuf::from("file2.txt")];
let output_path = PathBuf::from("archive.tar");
create_tar_archive(&files, &output_path).expect("TAR archive creation failed");
use zippylib::create_tar_gz_archive;
use std::path::PathBuf;
let files = vec![PathBuf::from("file1.txt"), PathBuf::from("file2.txt")];
let output_path = PathBuf::from("archive.tar.gz");
create_tar_gz_archive(&files, &output_path).expect("TAR.GZ archive creation failed");
use zippylib::create_tar_xz_archive;
use std::path::PathBuf;
let files = vec![PathBuf::from("file1.txt"), PathBuf::from("file2.txt")];
let output_path = PathBuf::from("archive.tar.xz");
create_tar_xz_archive(&files, &output_path).expect("TAR.XZ archive creation failed");
use zippylib::create_tar_bz2_archive;
use std::path::PathBuf;
let files = vec![PathBuf::from("file1.txt"), PathBuf::from("file2.txt")];
let output_path = PathBuf::from("archive.tar.bz2");
create_tar_bz2_archive(&files, &output_path).expect("TAR.BZ2 archive creation failed");
use zippylib::create_file_bzip2;
use std::path::PathBuf;
let input_path = PathBuf::from("file1.txt");
let output_path = PathBuf::from("file1.bz2");
create_file_bzip2(&input_path, &output_path).expect("BZ2 file creation failed");
use zippylib::create_file_xz;
use std::path::PathBuf;
let input_path = PathBuf::from("file1.txt");
let output_path = PathBuf::from("file1.xz");
create_file_xz(&input_path, &output_path).expect("XZ file creation failed");
use zippylib::create_gzip_archive;
use std::path::PathBuf;
let file_path = PathBuf::from("file1.txt");
let output_path = PathBuf::from("file1.gz");
create_gzip_archive(&file_path, &output_path).expect("GZ archive creation failed");
use zippylib::encode_file_deflate;
use std::path::PathBuf;
let file_to_compress = PathBuf::from("file1.txt");
let output_path = PathBuf::from("file1.deflate");
encode_file_deflate(&file_to_compress, &output_path).expect("Deflate encoding failed");
use zippylib::encode_file_zlib;
use std::path::PathBuf;
let file_to_compress = PathBuf::from("file1.txt");
let output_path = PathBuf::from("file1.zlib");
encode_file_zlib(&file_to_compress, &output_path).expect("Zlib encoding failed");
All operations are designed to return a Result<(), ErrorType>
, enabling robust error handling. Specific error types are defined to facilitate detailed error reporting and handling.
ZippyLib makes use of several third-party crates to support its functionality:
These dependencies are critical for providing the comprehensive compression and archiving capabilities of ZippyLib.
ZippyLib is licensed under the MIT LICENSE. The full license text is available in the LICENSE
file in the repository.