Version: 2.0.0_Beta This is the second major release of LittlePack, upgraded from .NET 4.0 to .NET 8.0 and rebuilt with full CLI support, encryption, pattern filtering, and test coverage.
LittlePack is a lightweight C# library for packing and unpacking collections of files into a single compressed byte array. It supports GZip compression, relative file path preservation, optional AES encryption, and filtering via wildcards. This library is ideal for bundling files for transport, backup, or use in custom archival formats.
- Pack and unpack collections of files using a simple
Recordmodel - Preserves folder structure using relative paths
- Uses GZip for compression
- Optional AES encryption using a password
- Supports file filtering via
--ignore,--only, and.littlepackignorepatterns - Designed for integration into CLI or backend tools
var files = Directory.GetFiles("./input", "*", SearchOption.AllDirectories);
var records = files.Select(f => new Record(
Path.GetRelativePath("./input", f),
File.ReadAllBytes(f))
).ToList();
var packer = new Packer(records);
var packedBytes = packer.Pack();
File.WriteAllBytes("archive.lpkg", packedBytes);var packer = new Packer();
packer.Records.Add(new Record { FileName = "file1.png", Data = File.ReadAllBytes(@"C:\\Data\\file1.png") });
packer.Records.Add(new Record { FileName = "file2.png", Data = File.ReadAllBytes(@"C:\\Data\\file2.png") });
packer.Records.Add(new Record { FileName = "file3.png", Data = File.ReadAllBytes(@"C:\\Data\\file3.png") });
byte[] package = packer.Pack();
File.WriteAllBytes(@"C:\\Temp\\package.pack", package);var packedBytes = File.ReadAllBytes("archive.lpkg");
var records = Packer.Unpack(packedBytes);
records.SaveTo("./output");// Encrypt
var encrypted = CryptoUtility.Encrypt(packedBytes, "MyPassword");
File.WriteAllBytes("secure.lpkg", encrypted);
// Decrypt
var decrypted = CryptoUtility.Decrypt(File.ReadAllBytes("secure.lpkg"), "MyPassword");
var records = Packer.Unpack(decrypted);Unit tests are included for:
- Encryption and decryption round-trips
- Packing/unpacking byte-level consistency
- CLI argument parsing and pattern filtering
To run tests:
dotnet testRecord.cs- Represents a file (name + data)Packer.cs- Handles pack/unpack logic with compressionCryptoUtility.cs- AES encryption and decryption helpersLittlePackExtensions.cs- File saving helpersCliParser.cs- CLI argument parsing and.littlepackignoresupportLittlePackCli.cs- Main runner for CLI mode
MIT License. Use it, fork it, break it, fix it — enjoy.