LittlePack 2.0.0
dotnet add package LittlePack --version 2.0.0
NuGet\Install-Package LittlePack -Version 2.0.0
<PackageReference Include="LittlePack" Version="2.0.0" />
<PackageVersion Include="LittlePack" Version="2.0.0" />
<PackageReference Include="LittlePack" />
paket add LittlePack --version 2.0.0
#r "nuget: LittlePack, 2.0.0"
#:package LittlePack@2.0.0
#addin nuget:?package=LittlePack&version=2.0.0
#tool nuget:?package=LittlePack&version=2.0.0
LittlePack
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.
✨ Features
- Pack and unpack collections of files using a simple
Record
model - Preserves folder structure using relative paths
- Uses GZip for compression
- Optional AES encryption using a password
- Supports file filtering via
--ignore
,--only
, and.littlepackignore
patterns - Designed for integration into CLI or backend tools
🧰 Usage
Packing Files (from Folder)
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);
Manual Packing (Individual Files)
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);
Unpacking Files
var packedBytes = File.ReadAllBytes("archive.lpkg");
var records = Packer.Unpack(packedBytes);
records.SaveTo("./output");
Optional Encryption
// 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);
🧪 Testing
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 test
📁 Project Structure
Record.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.littlepackignore
supportLittlePackCli.cs
- Main runner for CLI mode
📄 License
MIT License. Use it, fork it, break it, fix it — enjoy.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.