Interface IFileSource
Represents a file source, ie a mean for a target environment involved in a deployment to obtain the content of files being deployed.
Namespace: Umbraco.Cms.Core.Deploy
Assembly: Umbraco.Core.dll
Syntax
public interface IFileSource
Methods
View SourceGetFileContentAsync(StringUdi, CancellationToken)
Gets the content of a file as a string.
Declaration
Task<string> GetFileContentAsync(StringUdi udi, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
StringUdi | udi | A file entity identifier. |
CancellationToken | token | A cancellation token. |
Returns
Type | Description |
---|---|
Task<System.String> | A string containing the file content. |
Remarks
Returns null if no content could be read.
GetFileLengthAsync(StringUdi, CancellationToken)
Gets the length of a file.
Declaration
Task<long> GetFileLengthAsync(StringUdi udi, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
StringUdi | udi | A file entity identifier. |
CancellationToken | token | A cancellation token. |
Returns
Type | Description |
---|---|
Task<System.Int64> | The length of the file, or -1 if the file does not exist. |
GetFilesAsync(IEnumerable<StringUdi>, IFileTypeCollection, Boolean, CancellationToken)
Gets files and store them using a file store.
Declaration
Task GetFilesAsync(IEnumerable<StringUdi> udis, IFileTypeCollection fileTypes, bool continueOnFileNotFound, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<StringUdi> | udis | The UDIs of the files to get. |
IFileTypeCollection | fileTypes | A collection of file types which can store the files. |
System.Boolean | continueOnFileNotFound | A flag indicating whether to continue if a file isn't found or to stop and throw a FileNotFoundException. |
CancellationToken | token | A cancellation token. |
Returns
Type | Description |
---|---|
Task | The task object representing the asynchronous operation. |
GetFileStreamAsync(StringUdi, CancellationToken)
Gets the content of a file as a stream.
Declaration
Task<Stream> GetFileStreamAsync(StringUdi udi, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
StringUdi | udi | A file entity identifier. |
CancellationToken | token | A cancellation token. |
Returns
Type | Description |
---|---|
Task<Stream> | A stream with read access to the file content. |
Remarks
Returns null if no content could be read.
The caller should ensure that the stream is properly closed/disposed.