This project provides a set of Unix tools for .NET 8+.
Note: This project is still in early development and the API is subject to change.
- CPIO Archive: Read and write CPIO archives (Only the newc format is supported)
- UnixInMemoryFileSystem: A simple in-memory file system to manipulate files and directories
- This in memory filesystem can be used to easily manipulate in and out CPIO archives
- .NET 8.0+ compatible and NativeAOT ready
Reading a CPIO archive:
var cpioReader = new CpioReader(File.OpenRead("archive.cpio"));
while (cpioReader.TryGetNextEntry(out var entry))
{
Console.WriteLine($"Entry: {entry.Name} {entry.FileType} ({entry.Mode})");
})
Writing a CPIO archive with a UnixInMemoryFileSystem
:
var stream = new MemoryStream();
var fs = new UnixInMemoryFileSystem();
fs.CreateDirectory("/dir1");
fs.CreateDirectory("/dir1/dir2");
fs.CreateFile("/dir1/file1.txt", "Hello World");
{
using var writer = new CpioWriter(File.Create("archive.cpio"));
fs.WriteTo(writer);
}
This software is released under the BSD-2-Clause license.
Alexandre Mutel aka xoofx.