Search Results for

Show / Hide Table of Contents

# Interface IUploaderProvider

Defines the storage operations used by CoreUpload to save, read, move, and maintain uploaded files. Providers abstract where uploaded file contents and metadata live.

###### Namespace: CoreUpload.Providers

###### Assembly: CoreUpload.dll

##### Syntax

    public interface IUploaderProvider

### Methods

#### AppendAsync(Guid, string, Stream, CancellationToken)

Appends additional content to an existing uploaded file.

##### Declaration

    Task AppendAsync(Guid guid, string fileName, Stream stream, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | guid |
string | fileName |
Stream | stream |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task |

#### AssembleChunksAsync(string, string, int, CancellationToken)

Assembles all previously stored chunks for an upload session and returns the resulting file GUID.

##### Declaration

    Task<Guid> AssembleChunksAsync(string uploadId, string fileName, int totalChunks, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
string | uploadId |
string | fileName |
int | totalChunks |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task<Guid> |

#### CopyToAsync(Guid, string, CancellationToken)

Copies a stored upload to a new destination path while keeping the original file.

##### Declaration

    Task CopyToAsync(Guid guid, string destinationPath, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | guid |
string | destinationPath |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task |

#### DeleteAsync(Guid, CancellationToken)

Deletes a stored upload and its metadata.

##### Declaration

    Task DeleteAsync(Guid guid, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | guid |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task |

#### GetCompletedChunksAsync(string, CancellationToken)

Gets the number of chunks already stored for a chunked upload session.

##### Declaration

    Task<int> GetCompletedChunksAsync(string uploadId, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
string | uploadId |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task<int> |

#### GetFilePathAsync(Guid, CancellationToken)

Gets the local file-system path for a stored upload when the provider supports direct file access.

##### Declaration

    Task<string?> GetFilePathAsync(Guid guid, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | guid |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task<string> |

#### GetInfoAsync(Guid, CancellationToken)

Gets metadata for a stored upload. Returns null when the file does not exist.

##### Declaration

    Task<UploadedFileInfo?> GetInfoAsync(Guid guid, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | guid |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task<UploadedFileInfo> |

#### GetSavedChunksAsync(string, CancellationToken)

Gets the chunk indexes (and their stored byte sizes) already saved for a chunked upload session, so a resuming client can reconcile its local "completed" map with what the server actually holds. Returns null when the provider cannot enumerate chunks (the default for custom providers that predate this member).

##### Declaration

    Task<IReadOnlyDictionary<int, long>?> GetSavedChunksAsync(string uploadId, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
string | uploadId |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task<IReadOnlyDictionary<int, long>> |

#### GetUploadedLengthAsync(string, CancellationToken)

Gets the total number of bytes already stored for a chunked upload session.

##### Declaration

    Task<long> GetUploadedLengthAsync(string uploadId, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
string | uploadId |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task<long> |

#### MaintainAsync(CancellationToken)

Performs provider-specific maintenance such as expiring temporary uploads and stale chunk sessions.

##### Declaration

    Task MaintainAsync(CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task |

#### MoveToAsync(Guid, string, CancellationToken)

Moves a stored upload to a new destination path.

##### Declaration

    Task MoveToAsync(Guid guid, string destinationPath, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | guid |
string | destinationPath |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task |

#### OpenReadAsync(Guid, CancellationToken)

Opens a readable stream for a stored upload. The caller is responsible for disposing the returned stream.

##### Declaration

    Task<Stream> OpenReadAsync(Guid guid, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | guid |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task<Stream> |

#### PersistAsync(Guid, CancellationToken)

Marks a stored upload as persisted so routine cleanup does not remove it.

##### Declaration

    Task PersistAsync(Guid guid, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | guid |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task |

#### SaveAsync(Guid, string, Stream, CancellationToken)

Saves a new uploaded file and its metadata.

##### Declaration

    Task SaveAsync(Guid guid, string fileName, Stream stream, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
Guid | guid |
string | fileName |
Stream | stream |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task |

#### SaveChunkAsync(string, int, Stream, CancellationToken)

Saves a single chunk for an upload session.

##### Declaration

    Task SaveChunkAsync(string uploadId, int chunkIndex, Stream stream, CancellationToken ct = default)

##### Parameters

Type | Name | Description
--- | --- | ---
string | uploadId |
int | chunkIndex |
Stream | stream |
CancellationToken | ct |

##### Returns

Type | Description
--- | ---
Task |