UFile.PartialUploader 1.0.7

dotnet add package UFile.PartialUploader --version 1.0.7
NuGet\Install-Package UFile.PartialUploader -Version 1.0.7
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.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UFile.PartialUploader --version 1.0.7
#r "nuget: UFile.PartialUploader, 1.0.7"
#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.0.7

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

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 net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
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.0.7 94 6/16/2024
1.0.6 80 6/12/2024
1.0.5 88 6/2/2024
1.0.4 83 6/2/2024
1.0.3 73 6/2/2024
1.0.2 67 6/2/2024
1.0.1 71 6/2/2024
1.0.0 69 5/28/2024