FileUtils class

Medium

Terrasoft.File.Abstractions namespace.

The Terrasoft.File.Abstractions.FileUtils class provides extension methods for file management.

Methods 

static void SetAttributes(this IFile source, IReadOnlyDictionary<string, object> attributes)

Sets the file attributes to the values passed in the attributes collection.

static void Save(this IFile source)

Saves the metadata of the file.

static Stream Read(this IFile source)

Reads the content of the file.

static void Write(this IFile source, Stream stream, FileWriteOptions writeOptions) static void Write(this IFile source, byte[] content)

Writes the content of the file.

Parameters
source The file whose contents is to be written
stream The stream that provides the file content.
writeOptions Parameters for writing the file.
content The file content as an array of bytes.
static void Delete(this IFile source)

Deletes the specified file.

static void Copy(this IFile source, IFile target)

Copies the existing source file to the new target file.

static void Move(this IFile source, IFile target)

Moves the existing source file to the new target destination.