Summary

A filesystem. Could be on disk, or in memory, or in the cloud. Could be writable or read only. Or it could be an aggregation of all those things, merged together and read only.

Properties

IsValid

Methods

CreateDirectory Create a directory - or a tree of directories. Returns silently if the directory already exists.
CreateSubSystem Create a sub-filesystem at the specified path
DeleteDirectory Delete a folder and optionally all of its contents
DeleteFile Delete a file
DirectoryExists Returns true if the directory exists on this filesystem
DirectorySize Gets the size in bytes of all the files in a directory
FileExists Returns true if the file exists on this filesystem
FileSize Returns file size of given file.
FindDirectory Get a list of directories
FindFile Get a list of files
GetCrc Returns CRC64 of the file contents.
GetCrcAsync Returns CRC64 of the file contents.
GetFullPath Returns the full physical path to a file or folder on disk, or null if it isn't on disk.
OpenRead Open a file for read. Will throw an exception if it doesn't exist.
OpenWrite Open a file for write. If the file exists we'll overwrite it (by default)
ReadAllBytes Read the contents of path and return it as a string
ReadAllBytesAsync Read the contents of path and return it as a string
ReadAllText Read the contents of path and return it as a string. Returns null if file not found.
ReadAllTextAsync Read the contents of path and return it as a string
ReadJson Read Json from a file using System.Text.Json.JsonSerializer. This will throw exceptions if not valid json.
ReadJsonOrDefault The same as ReadJson except will return a default value on missing/error.
WriteAllText Write the contents to the path. The file will be over-written if the file exists
WriteJson Convert object to json and write it to the specified file
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.