Property Length
Length
Gets the size of the file in bytes.
Declaration
public long Length { get; }
Property Value
| Type | Description |
|---|---|
| long |
Remarks
An instance returned by an add knows the size already: the add takes it from the file it has just stored, so it is never read from the file system again. The variants that GetOrAddVariantAsync(FileId, string, string?, IFileProcessingPipelineSelector, CancellationToken) finds already stored are the exception and behave like fetched files.
An instance returned by a fetch reads the size from the file system the first time it is needed and keeps it: stored files never change, so it is the size the file had when it was fetched. Reading it for the first time after the file has been physically removed throws an IOException; a value read before that stays available. For a live read of the file on disk use Path.
Exceptions
| Type | Condition |
|---|---|
| IOException | The size has not been read yet and the file has been physically removed since it was fetched. |