Skip to content
Auto
Products

In-memory file system

This file system keeps a full read/write tree in memory. It is built into the TagBites.IO package, so no additional dependency is required. Content lives only as long as the FileSystem instance and never reaches a disk.

using var fileSystem = TagBites.IO.MemoryFileSystem.CreateMemory();
fileSystem.GetFile("/input/orders.csv").WriteAllText("id,total\n1,20");
var content = fileSystem.GetFile("/input/orders.csv").ReadAllText(); // "id,total\n1,20"

Each call returns a separate, empty file system, so parallel tests do not share state.

Hidden, read-only and last write time metadata are supported, as are permissions and direct stream access. There is no watcher - a change made to the tree raises no notification.

Disposing the FileSystem releases the content.