FileSystemStore

Namespace: Proffer.Storage.FileSystem

A File System store allows to save, list or read files on a container in its configured FileSystemStorageProvider.

public class FileSystemStore : Proffer.Storage.IStore

Inheritance ObjectFileSystemStore
Implements IStore

Properties

Name

Gets the name of the store.

public string Name { get; }

Property Value

String

Constructors

FileSystemStore(FileSystemStoreOptions, IPublicUrlProvider, IExtendedPropertiesProvider)

Initializes a new instance of the FileSystemStore class.

public FileSystemStore(FileSystemStoreOptions storeOptions, IPublicUrlProvider publicUrlProvider, IExtendedPropertiesProvider extendedPropertiesProvider)

Parameters

storeOptions FileSystemStoreOptions
The store options.

publicUrlProvider IPublicUrlProvider
The public URL provider.

extendedPropertiesProvider IExtendedPropertiesProvider
The extended properties provider.

Methods

InitAsync(CancellationToken)

Initializes the store by creating a container in its Proffer.Storage.IStorageProvider.

public Task InitAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task

        A task that represents the asynchronous operation.

ListAsync(String, Boolean, Boolean)

Lists the files under .

public ValueTask<IFileReference[]> ListAsync(string path, bool recursive, bool withMetadata)

Parameters

path String
The path.

recursive Boolean
If set to true, recurse the listing across folders.

withMetadata Boolean
If set to true, fetch metadata for each file.

Returns

ValueTask<IFileReference[]>

        The  list under .

ListAsync(String, String, Boolean, Boolean)

Lists the files under matching the .

public ValueTask<IFileReference[]> ListAsync(string path, string searchPattern, bool recursive, bool withMetadata)

Parameters

path String
The path.

searchPattern String
The search pattern.

recursive Boolean
If set to true, recurse the listing across folders.

withMetadata Boolean
If set to true, fetch metadata for each file.

Returns

ValueTask<IFileReference[]>

        The  list under  matching the .

GetAsync(IPrivateFileReference, Boolean)

Gets the file reference from path.

public ValueTask<IFileReference> GetAsync(IPrivateFileReference file, bool withMetadata)

Parameters

file IPrivateFileReference
The reference holding the file path.

withMetadata Boolean
If set to true, fetch metadata for the file.

Returns

ValueTask<IFileReference>

        The  at path.

GetAsync(Uri, Boolean)

Gets the file reference from URI.

public ValueTask<IFileReference> GetAsync(Uri uri, bool withMetadata)

Parameters

uri Uri
The file uniform resource identifier (URI).

withMetadata Boolean
If set to true, fetch metadata for the file.

Returns

ValueTask<IFileReference>

        The  at path.

Exceptions

InvalidOperationException

DeleteAsync(IPrivateFileReference)

Deletes the file.

public Task DeleteAsync(IPrivateFileReference file)

Parameters

file IPrivateFileReference
The reference holding the file path.

Returns

Task

ReadAsync(IPrivateFileReference)

Reads the file content.

public ValueTask<Stream> ReadAsync(IPrivateFileReference file)

Parameters

file IPrivateFileReference
The reference holding the file path.

Returns

ValueTask<Stream>

        A  containing the file content.

ReadAllBytesAsync(IPrivateFileReference)

Reads the file content.

public ValueTask<Byte[]> ReadAllBytesAsync(IPrivateFileReference file)

Parameters

file IPrivateFileReference
The reference holding the file path.

Returns

ValueTask<Byte[]>

        A  containing the file content.

ReadAllTextAsync(IPrivateFileReference)

Reads the file content.

public ValueTask<string> ReadAllTextAsync(IPrivateFileReference file)

Parameters

file IPrivateFileReference
The reference holding the file path.

Returns

ValueTask<String>

        A  containing the file content.

SaveAsync(Byte[], IPrivateFileReference, String, OverwritePolicy, IDictionary<String, String>)

Saves the file.

public ValueTask<IFileReference> SaveAsync(Byte[] data, IPrivateFileReference file, string contentType, OverwritePolicy overwritePolicy, IDictionary<string, string> metadata)

Parameters

data Byte[]
The file content.

file IPrivateFileReference
The reference holding the file path.

contentType String
The content-type of the file.

overwritePolicy OverwritePolicy
The overwrite policy.

metadata IDictionary<String, String>
The metadata.

Returns

ValueTask<IFileReference>

        The saved .

SaveAsync(Stream, IPrivateFileReference, String, OverwritePolicy, IDictionary<String, String>)

Saves the file.

public ValueTask<IFileReference> SaveAsync(Stream data, IPrivateFileReference file, string contentType, OverwritePolicy overwritePolicy, IDictionary<string, string> metadata)

Parameters

data Stream
The file content.

file IPrivateFileReference
The reference holding the file path.

contentType String
The content-type of the file.

overwritePolicy OverwritePolicy
The overwrite policy.

metadata IDictionary<String, String>
The metadata.

Returns

ValueTask<IFileReference>

        The saved .

Exceptions

Proffer.Storage.Exceptions.FileAlreadyExistsException

GetSharedAccessSignatureAsync(ISharedAccessPolicy)

Gets a shared access signature.

public ValueTask<string> GetSharedAccessSignatureAsync(ISharedAccessPolicy policy)

Parameters

policy ISharedAccessPolicy
The policy.

Returns

ValueTask<String>

        A shared access signature to read or list the store files.

Exceptions

NotSupportedException