IStoreExtensions

Namespace: Proffer.Storage

IStore extension methods.

public static class IStoreExtensions

Inheritance ObjectIStoreExtensions

Methods

ListAsync(IStore, String, Boolean, Boolean)

Lists the files under .

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

Parameters

store IStore
The store.

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(IStore, String, String, Boolean, Boolean)

Lists the files under matching the .

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

Parameters

store IStore
The store.

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 .

DeleteAsync(IStore, String)

Deletes the file.

public static Task DeleteAsync(IStore store, string path)

Parameters

store IStore
The store.

path String
The file path.

Returns

Task

        A task that represents the asynchronous operation.

GetAsync(IStore, String, Boolean)

Gets the file reference from path.

public static ValueTask<IFileReference> GetAsync(IStore store, string path, bool withMetadata)

Parameters

store IStore
The store.

path String
The file path.

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

Returns

ValueTask<IFileReference>

        The  at path.

ReadAsync(IStore, String)

Reads the file content.

public static ValueTask<Stream> ReadAsync(IStore store, string path)

Parameters

store IStore
The store.

path String
The file path.

Returns

ValueTask<Stream>

        A  containing the file content.

ReadAllBytesAsync(IStore, String)

Reads the file content.

public static ValueTask<Byte[]> ReadAllBytesAsync(IStore store, string path)

Parameters

store IStore
The store.

path String
The file path.

Returns

ValueTask<Byte[]>

        A  containing the file content.

ReadAllTextAsync(IStore, String)

Reads the file content.

public static ValueTask<string> ReadAllTextAsync(IStore store, string path)

Parameters

store IStore
The store.

path String
The file path.

Returns

ValueTask<String>

        A  containing the file content.

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

Saves the file.

public static ValueTask<IFileReference> SaveAsync(IStore store, Byte[] data, string path, string contentType, OverwritePolicy overwritePolicy, IDictionary<string, string> metadata)

Parameters

store IStore
The store.

data Byte[]
The file content.

path String
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

FileAlreadyExistsException

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

Saves the file.

public static ValueTask<IFileReference> SaveAsync(IStore store, Stream data, string path, string contentType, OverwritePolicy overwritePolicy, IDictionary<string, string> metadata)

Parameters

store IStore
The store.

data Stream
The file content.

path String
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

FileAlreadyExistsException