Show / Hide Table of Contents

Interface IStoreSupportProcessor

A processor that can store files in the repository.

Namespace: OpenText.Fusion.AdapterSdk.Api
Assembly: OpenText.Fusion.AdapterSdk.Api.dll
Syntax
public interface IStoreSupportProcessor

Methods

StoreFileAsync(IStoreFile, CancellationToken)

Store a file in the repository.

Declaration
Task<string> StoreFileAsync(IStoreFile fileToStore, CancellationToken cancellationToken)
Parameters
Type Name Description
IStoreFile fileToStore

The file to be stored.

CancellationToken cancellationToken

The cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task<System.String>

A representing the result of the asynchronous operation.

Examples

Example of a simple implementation that stores a file in a folder.

public async Task<string> StoreFileAsync(IStoreFile fileToStore, CancellationToken cancellationToken)
{
var destinationFileName = Path.Combine(_destination, fileToStore.Title);
using (var inputStream = fileToStore.OpenInputStream())
using (var destinationFileStream = new FileStream(destinationFileName, FileMode.CreateNew))
{
    await inputStream.CopyToAsync(destinationFileStream, 81920, cancellationToken).ConfigureAwait(false);
    destinationFileStream.Flush();
}
return destinationFileName;
}
In This Article
Back to top Generated by DocFX