Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.69 KB

readme.md

File metadata and controls

48 lines (34 loc) · 1.69 KB

XenoAtom.UnixTools ci NuGet

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.

✨ Features

  • 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

📖 Usage

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);
}

🪪 License

This software is released under the BSD-2-Clause license.

🤗 Author

Alexandre Mutel aka xoofx.