Deleting processed files when upload is complete
Stefan Matsson edited this page Dec 9, 2020
·
2 revisions
tusdotnet does not automatically delete files after they are processed, it has to be done manually.
When using TusDiskStore
, it implements ITusTerminationStore
which allows deleting files.
OnFileCompleteAsync = async ctx =>
{
ITusFile file = ctx.GetFileAsync();
var stream = await file.GetContentAsync(eventContext.CancellationToken);
await WriteFileToOtherDisk(stream);
// Don't forget to dispose the stream if you're using it!
await stream.DisposeAsync();
var terminationStore = (ITusTerminationStore)ctx.Store;
await terminationStore.DeleteFileAsync(file.Id, ctx.CancellationToken);
}
Configuration
Using
- Validating metadata before creating a file
- Processing a completed upload
- Downloading files
- Removing expired incomplete files
Customize
Technical