Skip to content

BH.oM.Adapters.File.FSFile

A FileSystem-hosted File. It can include the content of the File.

Class structure

Implemented interfaces and base types

The FSFile is inheriting from the following base type(s) and implements the following interfaces:

Properties

Defining properties

The following properties are defined on the class

Name Type Description Quantity
ParentDirectory FSDirectory Full path of parent Directory of the File. You can also specify a string path. -
Name string Name of the file, INCLUDING Extension. -
Exists Nullable<bool> Gets a value indicating whether a file exists. -
IsReadOnly Nullable<bool> Gets or sets a value that determines if the current file is read only. -
Size int The size of the File in bytes. -
Attributes FileAttributes Attributes indicating if ReadOnly, Hidden, System File, etc. -
CreationTimeUtc DateTime - -
ModifiedTimeUtc DateTime - -
Owner string User owning the file, if any, or the user who created the File. -
Content List<object> The content of the file. -

Inherited properties

The following properties are inherited from the base class of the object

Name Type Description Quantity
BHoM_Guid Guid - -
Fragments FragmentSet - -
Tags HashSet<string> - -
CustomData Dictionary<string, object> - -

Derived properties

The following properties are defined as extension methods in one of the BHoM_Engines

Name Type Description Quantity Engine
ContentsAsByteArray byte[] Get the contents of the file as a byteArray, reading from its location. - File_Engine
ContentsAsString string Get the contents of the file as a string, reading from its location. - File_Engine
Encoding Encoding Try to get the encoding of the file. - File_Engine
IsAcyclic bool Test whether the file hierarchy is acyclic, i.e. has no loops in it. - File_Engine
NestingDepth int Get the nesting depth of the input File or Directory, which is the total number of parent folders. - File_Engine

Code and Schema

C# implementation

C#
public class FSFile : BH.oM.Base.BHoMObject,
BH.oM.Base.IBHoMObject,
BH.oM.Base.IObject,
BH.oM.Adapters.File.IFSContainer,
BH.oM.Adapters.File.IFSInfo,
BH.oM.Adapters.File.IContainableResource,
BH.oM.Adapters.File.IResource,
BH.oM.Adapters.File.IFile,
BH.oM.Adapters.File.ISizeableResource

Assembly: File_oM.dll

The C# class definition is available on github:

All history and changes of the class can be found by inspection the history.

JSON Schema implementation

The object is defined as a JSON schema. You can validate a JSON instance against this schema by reference. To do this, use the schema reference below in a validator like this one.

JSON Schema
{
 "$ref" : "https://raw.githubusercontent.com/BHoM/BHoM_JSONSchema/develop/File_oM/FSFile.json"
}

The JSON Schema is available on github here: