class BaseFileSystem

in global :: Sandbox

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.


public bool IsValid { get; }

🤡 Doc inheritance is not yet supported.

No summary.

public IEnumerable<string> FindDirectory( string folder, string pattern = *, bool recursive = False )

Get a list of directories

public IEnumerable<string> FindFile( string folder, string pattern = *, bool recursive = False )

Get a list of files

public void DeleteDirectory( string folder, bool recursive = False )

Delete a folder and optionally all of its contents

public void DeleteFile( string path )

Delete a file

public void CreateDirectory( string folder )

Create a directory - or a tree of directories. Returns silently if the directory already exists.

public bool FileExists( string path )

Returns true if the file exists on this filesystem

public bool DirectoryExists( string path )

Returns true if the directory exists on this filesystem

public string GetFullPath( string path )

Returns the full physical path to a file or folder on disk, or null if it isn't on disk.

public void WriteAllText( string path, string contents )

Write the contents to the path. The file will be over-written if the file exists

public string ReadAllText( string path )

Read the contents of path and return it as a string. Returns null if file not found.

public Span<byte> ReadAllBytes( string path )

Read the contents of path and return it as a string

public Task<byte[]> ReadAllBytesAsync( string path )

Read the contents of path and return it as a string

public Task<string> ReadAllTextAsync( string path )

Read the contents of path and return it as a string

public BaseFileSystem CreateSubSystem( string path )

Create a sub-filesystem at the specified path

public Stream OpenWrite( string path, FileMode mode = Create )

Open a file for write. If the file exists we'll overwrite it (by default)

public Stream OpenRead( string path, FileMode mode = Open )

Open a file for read. Will throw an exception if it doesn't exist.

public int DirectorySize( string path, bool recursive = False )

Gets the size in bytes of all the files in a directory

public Task<ulong> GetCrcAsync( string filepath )

Returns CRC64 of the file contents.

  • filepath File path to the file to get CRC of.
  • Returns The CRC64, or 0 if file is not found.

public ulong GetCrc( string filepath )

Returns CRC64 of the file contents.

  • filepath File path to the file to get CRC of.
  • Returns The CRC64, or 0 if file is not found.

public long FileSize( string filepath )

Returns file size of given file.

  • filepath File path to the file to look up size of.
  • Returns File size, in bytes.

public T ReadJson( string filename, T defaultValue = null )

😔 No documentation found.

public T ReadJsonOrDefault( string filename, T returnOnError = null )

😔 No documentation found.

public void WriteJson( string filename, T data )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public bool Equals( object obj )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.