Skip to content

kidulter5752/RustCompress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RustCompress Project English Introduction This Rust project implements a simple file compression utility using the flate2 library for gzip compression. It takes two command-line arguments: a source file to compress and a target file to store the compressed output. The program measures and reports the source file size, the compressed file size, and the elapsed time for the compression process. Features

Input/Output: Reads from a source file and writes compressed data to a target file. Compression: Utilizes flate2 for gzip compression with a default compression level. Performance: Tracks and displays the time taken for compression. Error Handling: Checks for correct command-line arguments; panics on file or I/O errors.

Usage

Ensure Rust and Cargo are installed. Run the program:cargo run -- source_file target_file

Output includes: Source file size (in bytes) Compressed file size (in bytes) Elapsed time for compression

中文介绍 这个 Rust 项目实现了一个简单的文件压缩工具,使用 flate2 库进行 gzip 压缩。它接受两个命令行参数:要压缩的源文件和存储压缩输出的目标文件。程序会测量并报告源文件大小、压缩后文件大小以及压缩过程的耗时。 功能

输入/输出:从源文件读取数据,将压缩后的数据写入目标文件。 压缩:使用 flate2 进行 gzip 压缩,采用默认压缩级别。 性能:跟踪并显示压缩所需的时间。 错误处理:检查命令行参数是否正确;文件或 I/O 错误时程序会终止。

使用方法

确保已安装 Rust 和 Cargo。 运行程序:cargo run -- 源文件 目标文件

输出包括: 源文件大小(以字节为单位) 压缩后文件大小(以字节为单位) 压缩耗时

Dependencies

flate2: For compression and decompression. Standard Rust libraries: std::env::args, std::fs::File, std::io, std::time.

依赖

flate2:用于压缩和解压缩。 Rust 标准库:std::env::args、std::fs::File、std::io、std::time。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages