LittlePack 1.0.0.1
See the version list below for details.
dotnet add package LittlePack --version 1.0.0.1
NuGet\Install-Package LittlePack -Version 1.0.0.1
<PackageReference Include="LittlePack" Version="1.0.0.1" />
<PackageVersion Include="LittlePack" Version="1.0.0.1" />
<PackageReference Include="LittlePack" />
paket add LittlePack --version 1.0.0.1
#r "nuget: LittlePack, 1.0.0.1"
#:package LittlePack@1.0.0.1
#addin nuget:?package=LittlePack&version=1.0.0.1
#tool nuget:?package=LittlePack&version=1.0.0.1
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 Framework | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
This package has 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.