#archive #archive-format #package #file #header #file-path #file-offset

已删除 klu

一个小型库/命令行工具,用于处理简单的归档格式

0.1.0 2022年7月4日

#12 in #file-offset

MIT 许可证

17KB
384

KLU

这是一个简单的归档格式。它分为两部分: - 标头 - 数据

标头

Every file / directory has an header with some information about the itself.
it contains the file path (ending with a "/" for directory), the filesize, and file offset inside the archive)
the details on how it is stored is still WIP but currently it is like this: 
```
	file_size: u64,
	file_offset: u64,
	file_path_size: u16,
	file_path: PathBuf (file_path_size bytes long)
```

数据

The file's data is stored in a sequential way, where every files are concatanated together and we only choose which part of we take to grab archive's files;

API

当前API非常基础:从目录创建归档和从Reader读取归档 + 读取文件。

读取/解析归档

您应该将reader包装在BufReader中,因为它将进行很多小读取(如2-8字节读取)

创建归档

对于第一个版本,创建归档的唯一方式是通过文件系统。您不需要将writer包装在BufWriter中,因为它已在函数内部包装。

命令行界面

命令行界面允许您列出文件、打包和解包归档。要获取命令行界面,请执行cargo install klu --features cli并使用klu help获取命令列表

依赖项

~0.4–8MB
~60K SLoC