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 SourceGetFileContent(StringUdi)
Gets the content of a file as a string.
Declaration
string GetFileContent(StringUdi udi)
Parameters
Type | Name | Description |
---|---|---|
StringUdi | udi | A file entity identifier. |
Returns
Type | Description |
---|---|
System.String | A string containing the file content. |
Remarks
Returns null if no content could be read.
GetFileContentAsync(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.
GetFileLength(StringUdi)
Gets the length of a file.
Declaration
long GetFileLength(StringUdi udi)
Parameters
Type | Name | Description |
---|---|---|
StringUdi | udi | A file entity identifier. |
Returns
Type | Description |
---|---|
System.Int64 | The length of the file, or -1 if the file does not exist. |
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. |
GetFiles(IEnumerable<StringUdi>, Boolean, IFileTypeCollection)
Gets files and store them using a file store.
Declaration
void GetFiles(IEnumerable<StringUdi> udis, bool continueOnFileNotFound, IFileTypeCollection fileTypes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<StringUdi> | udis | The UDIs of the files to get. |
System.Boolean | continueOnFileNotFound | A flag indicating whether to continue if a file isn't found or to stop and throw a FileNotFoundException. |
IFileTypeCollection | fileTypes | A collection of file types which can store the files. |
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. |
GetFileStream(StringUdi)
Gets the content of a file as a stream.
Declaration
Stream GetFileStream(StringUdi udi)
Parameters
Type | Name | Description |
---|---|---|
StringUdi | udi | A file entity identifier. |
Returns
Type | Description |
---|---|
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.
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.