EasyChunkUpload 1.0.0
dotnet add package EasyChunkUpload --version 1.0.0
NuGet\Install-Package EasyChunkUpload -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasyChunkUpload" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EasyChunkUpload" Version="1.0.0" />
<PackageReference Include="EasyChunkUpload" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add EasyChunkUpload --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: EasyChunkUpload, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package EasyChunkUpload@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EasyChunkUpload&version=1.0.0
#tool nuget:?package=EasyChunkUpload&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
ChunkUpload Service
A robust implementation for handling large file uploads using chunking strategy with resumable capabilities and concurrent processing support.
Table of Contents
- Features
- Installation
- Requirements
- Quick Start
- Configuration
- API Documentation
- Performance
- Contributing
- License
Features <a name="features"></a>
- ๐ Resumable Uploads - Continue interrupted uploads
- โก Chunk Validation - Automatic chunk order verification
- ๐ Concurrency Control - Thread-safe operations with SemaphoreSlim
- ๐ Atomic Merging - Temp file strategy for data integrity
- ๐ Progress Tracking - Real-time upload status monitoring
- ๐งน Auto-Cleanup - Configurable temp file retention
Installation <a name="installation"></a>
# Package Manager
Install-Package EasyChunkUpload
# .NET CLI
dotnet add package EasyChunkUpload
Requirements <a name="requirements"></a>
- .NET 9.0 SDK or later
- Entity Framework Core 9.x
Quick Start <a name="quick-start"></a>
1. Configure Services
{
services.AddEasyChunkUploadConfiguration(new ChunkUploadSettings{
TempFolder = "your_temp_folder",
CleanupInterval= 60 * 60 * 24, //in seconds
CompletedFilesExpiration= 60 * 60 // in seconds
});
// Add other dependencies
}
2. Basic Usage Example
{
private readonly IChunkUpload _chunkUpload;
public UploadController(IChunkUpload chunkUpload)
{
_chunkUpload = chunkUpload;
}
[HttpPost("start")]
public async Task<IActionResult> StartUpload([FromBody] FileInfoModel model)
{
var fileId = await _chunkUpload.StartUploadAsync(model.FileName);
return Ok(new { FileId = fileId });
}
}
Option Configuration(ChunkUploadSettings) <a name="configuration"></a>
Setting | Type | Default | Description |
---|---|---|---|
TempFolder |
string |
Required | Temporary storage directory path for chunks |
CleanupInterval |
int |
3600 |
Temp files cleanup interval (seconds) |
CompletedFilesExpiration |
int |
60*60*24*7 |
how Many (Seconds) time File While be expired after upload lastest chunk |
API Documentation <a name="api-documentation"></a>
Core Methods
public interface IChunkUpload
{
/// <summary>Initializes new upload session</summary>
Task<Guid> StartUploadAsync(string fileName);
/// <summary>Retrieves last uploaded chunk number</summary>
Task<ChunkResponse<int>> GetLastChunk(Guid fileId);
/// <summary>Processes chunk from Stream source</summary>
Task<ChunkResponse<Object>> UploadChunkAsync(Guid fileId, int chunkNumber, Stream fileContent);
/// <summary>Processes chunk from byte array</summary>
Task<ChunkResponse<Object>> UploadChunkAsync(Guid fileId, int chunkNumber,byte[] fileContent);
/// <summary>Finalizes upload and merges chunks</summary>
Task<ChunkResponse<string>> ChunkUploadCompleted(Guid fileId);
/// <summary>Identifies missing chunks in sequence</summary>
Task<ChunkResponse<List<int>>> GetLostChunkNumber(Guid fileId);
/// <summary>Cancels active upload session</summary>
Task<ChunkResponse<bool>> CancelUploadAsync(Guid fileId);
}
Response Model
public class ChunkResponse<T>
{
/// <summary>Detailed message for failures or success</summary>
public string Message{get;set;}
/// <summary>Operation status</summary>
public bool Status{get;set;}
/// <summary>Result payload</summary>
public T Data {get;set;}
}
Performance <a name="performance"></a>
Optimization Tips :
Chunk Sizes: Use 5-10MB chunks for optimal throughput
File Locking: Monitor SemaphoreSlim usage
Contributing <a name="contributing"></a>
Fork the repository
Create feature branch:
git checkout -b feature/your-feature
Commit changes:
git commit -m 'Add awesome feature'
Push to branch:
git push origin feature/your-feature
Open a Pull Request
License <a name="license"></a>
MIT License - See LICENSE for full text.
๐ซ Contact: [Ali Hmaidi] - alihmaidi095@gmail.com
๐ Repository: https://github.com/alihmaidi1/EasyChunckUpload
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Microsoft.EntityFrameworkCore (>= 9.0.1)
- Microsoft.Extensions.DependencyInjection (>= 9.0.1)
- Microsoft.Extensions.Hosting (>= 9.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
1.0.0 | 109 | 1/23/2025 |