Interface IRepoFile
Represents a file stored in an IFileRepo: a main file or one of its variants.
Namespace: FulcrumFS
Assembly: FulcrumFS.dll
Syntax
public interface IRepoFile
Remarks
An instance describes the file as it was when it was fetched. Stored files never change once they are added, so the description stays accurate for as long as the file exists, but the file can be deleted afterwards, after which OpenReadAsync(FileAccessPattern, CancellationToken) may fail, and so may GetLengthAsync(CancellationToken) if the instance does not know the size yet.
The interface does not expose where or how the content is stored, since an implementation does not have to keep files in a local file system: the content is
read through OpenReadAsync(FileAccessPattern, CancellationToken). The local implementation, RepoFileInfo, also exposes the path
of the file.
The size of the file is obtained on demand through GetLengthAsync(CancellationToken) rather than reported when the file is fetched, so that a
fetch costs no more than finding the file, while a file returned by an add knows its size already. The length of an opened stream is the size of the file
as well. The local implementation also has RepoFileInfo.Length, which answers from the same cached size.
Properties
| Name | Description |
|---|---|
| Extension | Gets the extension of the file including the leading period, or an empty string if it has no extension. |
| FileId | Gets the ID of the file group the file belongs to. |
| VariantId | Gets the variant ID of the file in its normalized (lowercase) form, or null if this is the main file. |
Methods
| Name | Description |
|---|---|
| GetLengthAsync(CancellationToken) | Gets the size of the content of the file in bytes. |
| OpenReadAsync(FileAccessPattern, CancellationToken) | Opens a read-only, seekable stream over the content of the file. |