- Lua 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| par.lua | ||
| README.md | ||
PAR (Package ARchive)
A minimal file archive format, and a command-line utility to bundle and extract them.
Usage
par.lua is designed for use on ComputerCraft machines. To run it on a standard system, use cc-desk.
Create archive: par <archive> <files to bundle...>
Extract archive: par -x <archive>
Examples:
> par archive.par hello.txt song.dfpwm
> par programs.par rom/programs/*
> par -x archive.par
> par -x programs.par
Format
PAR archives contain a header with a list of entries, and the file data itself.
Header
The archive begins with a 1-byte version and 2-byte entry_count. As of writing, the current version is 1.
Entry List
Immediately following the header is an entry_count-long list of entries with the following format:
| Size | Name | Description |
|---|---|---|
| 1 | path_length |
Length of the following path field in bytes |
path_length |
path |
Path of this entry, should be treated as relative to the extraction directory |
| 4 | offset |
Offset in this archive where the contents of this file are located |
| 1 | flags |
Set of bitflags (currently unused) |
After the entry list is a blob containing the (currently uncompressed) contents of every file in the archive. There may be a gap between the end of the entry list and the beginning of the contents, but there must not be a gap between the contents of each file, and they must be in the order listed in the entry list.