- β Fixed footer structure (v1.2 deterministic format)
- β Standardized chunk format (encrypted + plain)
- β Fixed index offset validation issues
- β Added footer magic validation (
FLOF) - β Stronger container corruption detection
- β Password-based encryption (PBKDF2 + AES)
- β Encryption contract stabilized (AES-CBC defined)
- β Password verification via SHA256 check
- β Safer chunk validation during streaming
- β Safe offset & length validation
- β Stronger reader error handling
- β Deterministic file structure
FILO (Files In, Layered & Organized) is a modern multi-file container format for .NET designed for large-scale file storage and streaming.
It supports:
- Large files (GB-sized video/audio/binaries)
- Multi-file containers
- Chunked streaming (memory efficient)
- Optional AES256 encryption per chunk
- Embedded metadata & integrity checks
- Fully async APIs
FILO is designed for streaming-first storage systems, not just archive compression.
Traditional formats like ZIP have limitations:
- β Poor streaming support
- β Weak chunk-level control
- β No streaming encryption model
- β Limited metadata structure
FILO solves this by:
- Streaming files in chunks
- Encrypting per chunk
- Embedding structured metadata
- Supporting direct streaming without extraction
+------------------------------------------------+
| HEADER (JSON) |
|------------------------------------------------|
| - Format: FILO |
| - Version: 1.2 |
| - ChunkSize |
| - FileCount |
| - Encryption Mode (AES-CBC) |
| - KDF (PBKDF2) |
+------------------------------------------------+
| FILE CHUNKS |
| [IV][LEN][DATA] (encrypted) |
| [LEN][DATA] (plain) |
+------------------------------------------------+
| INDEX (JSON) |
+------------------------------------------------+
| METADATA (JSON) |
+------------------------------------------------+
| CHECKSUM (JSON) |
+------------------------------------------------+
| FOOTER |
| - IndexOffset |
| - MetadataOffset |
| - ChecksumOffset |
| - "FLOF" magic |
+------------------------------------------------+
This design allows streaming large files directly, without full extraction.
| Feature | FILO | ZIP | JSON Container | Raw BLOB |
|---|---|---|---|---|
| Multi-file support | β Yes | β Yes | β No | β No |
| Streaming large files | β Yes, chunked | β Needs extraction | β Needs parsing | β No |
| Async support | β Fully async | β Limited | β Async with lib | β Async |
| Encryption | β Chunk-level AES256 | β Whole file | β No native | β App-level |
| Metadata storage | β Embedded JSON | β Limited | β Yes | β No |
| Checksums / Integrity | β SHA256 per file | β Optional | β Needs custom | β Needs custom |
| Browser/Blazor streaming | β Yes | β No | β No | β No |
FILO is ideal for media, backups, and server-side streaming where large files need chunked access.
Install via NuGet:
dotnet add package Filo --version 1.2.0using Filo;
var writer = new FiloWriter("backup.filo")
.AddFile("video.mp4", new FileMetadata { MimeType = "video/mp4" })
.AddFile("audio.mp3", new FileMetadata { MimeType = "audio/mpeg" })
.WithChunkSize(5_000_000)
.WithPassword("1234567890");
await writer.WriteAsync();
Console.WriteLine("FILO container created!");var reader = new FiloReader("backup.filo");
await reader.InitializeAsync();
var key = reader.DeriveKey("1234567890");
foreach (var file in reader.ListFiles())
{
Console.WriteLine($"{file.Name} ({file.FileSize} bytes)");
}await using var stream = reader.OpenStream("video.mp4", key);
await using var output = File.Create("restored.mp4");
await stream.CopyToAsync(output);await foreach (var chunk in reader.StreamFileAsync("video.mp4", key))
{
// Process streaming data
}- Encrypted chunk format:
[16-byte IV][4-byte length][encrypted data] - Plain chunk format:
[4-byte length][plain data]
- Key derived using PBKDF2 (100k iterations)
- AES-CBC encryption per chunk
- Password verification via SHA256 key hash
- Each chunk is validated using SHA256:
var checksum = await FiloChecksum.ComputeFileSHA256Async("video.mp4");
- Prevents corrupted chunk playback
- Ensures file integrity during streaming
public async Task<IActionResult> GetVideo()
{
var reader = new FiloReader("media.filo");
await reader.InitializeAsync();
var key = reader.DeriveKey("password");
var stream = new FiloStream(reader, "movie.mp4", key);
return File(stream, "video/mp4");
}Supports large files, streaming, and AES256 encrypted chunks. Browser can seek, pause, and resume seamlessly.
var writer = new FiloWriter("media.filo")
.AddFile("movie.mp4", new FileMetadata { MimeType = "video/mp4" })
.AddFile("audio.mp3", new FileMetadata { MimeType = "audio/mpeg" })
.AddFile("subtitle.srt", new FileMetadata { MimeType = "text/plain" })
.WithChunkSize(10_000_000)
.WithPassword("mypassword");
await writer.WriteAsync();- Stores indexes, metadata, and checksums
- Stream each file individually using
FiloStreamorStreamFileAsync
- Reads files in memory-efficient chunks
- Ideal for large video/audio files
- Supports AES256 encryption per chunk
await foreach (var chunk in reader.StreamFileAsync("largevideo.mp4", key))
{
// Process chunk (send to player or API)
}| Method | Use Case |
|---|---|
OpenStream() |
Direct file streaming |
FiloStream |
ASP.NET / UI streaming |
StreamFileAsync() |
Custom chunk processing |
CopyToAsync() |
Extraction |
new FileMetadata
{
MimeType = "video/mp4",
Description = "Main movie file"
}Always verify checksum for large file integrity.
var checksum = await FiloChecksum.ComputeFileSHA256Async("video.mp4");
Console.WriteLine(checksum);- Ensures streamed files match the original
| Class | Key Methods |
|---|---|
FiloWriter |
.AddFile(), AddDirectory(), .WithChunkSize(), .WithPassword(), .WriteAsync() |
FiloReader |
.InitializeAsync(), DeriveKey(), FileExists(), GetFileInfo(), .ListFiles(), .StreamFileAsync(), OpenStream(), ExtractFileAsync(), ExtractDirectoryAsync(), ReadHeaderAsync() |
FiloStream |
.ReadAsync() β supports streaming directly to players, Read() |
FiloChecksum |
.ComputeSHA256(), .ComputeSHA256Async(), .ComputeFileSHA256Async(), .ComputeFileSHA256Async(),.Verify(), VerifyFileAsync() |
FiloEncryption |
.Encrypt(), .Decrypt() |
| Class | Responsibility |
|---|---|
| FiloWriter | Builds container |
| FiloReader | Reads container |
| FiloStream | Streaming abstraction |
| FiloChecksum | Integrity verification |
| FiloEncryption | AES operations |
- Footer size is fixed (28 bytes)
- Chunk offsets always point to chunk start
- AES-CBC is the defined encryption mode
- Index must always validate against file length
- Footer magic must be "FLOF"
MIT License