UFile.PartialUploader 1.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package UFile.PartialUploader --version 1.1.2                
NuGet\Install-Package UFile.PartialUploader -Version 1.1.2                
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="UFile.PartialUploader" Version="1.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UFile.PartialUploader --version 1.1.2                
#r "nuget: UFile.PartialUploader, 1.1.2"                
#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.
// Install UFile.PartialUploader as a Cake Addin
#addin nuget:?package=UFile.PartialUploader&version=1.1.2

// Install UFile.PartialUploader as a Cake Tool
#tool nuget:?package=UFile.PartialUploader&version=1.1.2                

The UFile library facilitates the uploading and processing of large files by handling them in smaller chunks. It provides functionality to save chunks, retry failed uploads, merge chunks into the final file, and store the completed file in a specified directoryThis approach is particularly useful for improving upload reliability and efficiency, especially for large files or unstable network conditions.

Examples

dotnet add package UFile.PartialUploader
public static IServiceCollection AddServices(this IServiceCollection services, IConfiguration conf)
{
    // Adds the UFile service to the specified service collection.
    services.AddUFile("App_Data", "tmp");

    return services;
}

    [Route("api/[controller]")]
    [ApiController]
    public class FileController(IUFileService uFileService) : ControllerBase
    {
        [HttpPost("upload")]
        public async Task<IActionResult> Upload() => StatusCode((int)await uFileService.UploadChunkFiles(Request));
    }

npm install partial-uploader

const file = event.target.files[0];

uploadFile = (file: File) => uploadWithPartialFile("/File/upload", file, 
    //you can add header here
    { "Authorization": `Bearer ${token}` });

let uploadResponse = await uploadFile(file);
if (uploadResponse.success)
{
    // your file will be inside the folder at this location
    const path = 'App_Data/tmp/' + uploadResponse.id;
}

    var fileInfo = UFileHelper.GetFileInfo(tempFolderId);

// Server Side Upload

    public class Test(IUFileService uFileService)
    {
        public async Task Upload()
        {
            var path = Path.Combine(Directory.GetCurrentDirectory(), "App_Data", "path/to/your/file.txt");

            var res = await UploadWithPartialFileAsync("https://example.com/upload", path, new Dictionary<string, string>
            {
                { "Authorization", "Bearer your_token" }
            });
        }
    }

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.3 171 10/4/2024
1.1.2 81 10/4/2024
1.1.1 84 10/4/2024
1.1.0 81 10/4/2024
1.0.9 84 10/4/2024
1.0.8 90 10/4/2024
1.0.7 193 6/16/2024
1.0.6 110 6/12/2024
1.0.5 119 6/2/2024
1.0.4 121 6/2/2024
1.0.3 106 6/2/2024
1.0.2 102 6/2/2024
1.0.1 99 6/2/2024
1.0.0 97 5/28/2024