Class FileProcessingContext
Represents the context for processing a file, providing access to the source file or stream and methods to create new work files or directories.
Implements
Namespace: FulcrumFS
Assembly: FulcrumFS.dll
Syntax
public sealed class FileProcessingContext : IAsyncDisposable
Properties
| Name | Description |
|---|---|
| CancellationToken | Gets the cancellation token that can be used to observe cancellation requests. |
| Extension | Gets the file extension of the source, including the leading dot (e.g., ".jpg", ".png"), otherwise an empty string. File extensions are always lowercase. |
| FileId | Gets the file ID that is being processed in the pipeline. |
| HasChanges | Gets a value indicating whether the source has had any changes made to it during processing. |
| IsLastProcessStep | Gets a value indicating whether the pipeline is at the last process step. |
| VariantId | Gets the variant ID of the file being processed in the pipeline, or null if the file is not a variant. |
Methods
| Name | Description |
|---|---|
| DisposeAsync() | Asynchronously releases the resources used by the instance, including disposing the source (if owned) and deleting the temporary working directory. |
| GetNewWorkDirectory() | Gets a new non-existent directory path that can be used for any intermediate work required by a FileProcessor or to store the final result. The directory is not created automatically. Work directories are automatically cleaned up after the processing pipeline completes but file processors can clean up intermediate work directories or their contents earlier if they are no longer needed. |
| GetNewWorkFile(string) | Gets a new non-existent file path that can be used for any intermediate work required by a FileProcessor or to store the final result. The file is not created automatically. Work files are automatically cleaned up after the processing pipeline completes but file processors can clean up intermediate work files earlier if they are no longer needed. |
| GetSourceAsFileAsync() | Gets the source as an IAbsoluteFilePath. If the source is a non-file stream, it will be copied to a new work file and returned. If the source is already an IAbsoluteFilePath, it will be returned directly. |
| GetSourceAsSeekableStreamAsync(bool, long) | Gets the source as a seekable Stream. |
| IsTempWorkingFile(IAbsoluteFilePath) | Gets a value indicating whether the specified file is located within the temporary working directory for this processing context. |