Flowsy.Web.Streaming 0.1.0

dotnet add package Flowsy.Web.Streaming --version 0.1.0                
NuGet\Install-Package Flowsy.Web.Streaming -Version 0.1.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="Flowsy.Web.Streaming" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Flowsy.Web.Streaming --version 0.1.0                
#r "nuget: Flowsy.Web.Streaming, 0.1.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.
// Install Flowsy.Web.Streaming as a Cake Addin
#addin nuget:?package=Flowsy.Web.Streaming&version=0.1.0

// Install Flowsy.Web.Streaming as a Cake Tool
#tool nuget:?package=Flowsy.Web.Streaming&version=0.1.0                

Flowsy Web Streaming

This package includes some services to use buffering when processing multipart requests.

Configure Services

var builder = WebApplication.CreateBuilder(args);

// This step is optional, if no options are configured, BufferingProvider will use default values
builder.Services.Configure<FileBufferingOptions>(options =>
{
    // Set values according to your specific use case
    // options.MemoryThreshold = 0; 
    // options.BufferLimit = 0;
    // options.TempFileDirectory = "";
    // options.TempFileDirectoryAccessor = () => "";
    // options.BytePool = ArrayPool<byte>.Shared;
});

// Configure buffering
builder.Services.AddSingleton<IBufferingProvider, BufferingProvider>();

// Optionally, configure a content inspector with classes from the Flowsy.Content package
builder.Services.AddSingleton<IContentInspector, BasicContentInspector>();

// Configure the the multipart handler
builder.Services.AddSingleton<MultipartHandler>(serviceProvider =>
{
    return new MultipartHandler(
        serviceProvider.GetService<IBufferingProvider>(),
        serviceProvider.GetService<IContentInspector>(),
        serviceProvider.GetService<IConfiguration>()?
            .GetSection("SomeConfiguration:AllowedMimeTypes")
            .GetChildren()
            .Select(c => c.Value!)
        );
});

// Configure more services

var app = builder.Build();

// Configure request pipeline

app.Run();

Processing Requests

[ApiController]
[Route($"{Routes.Content}/[controller]")]
public class SomeController : ControllerBase
{
    private readonly MultipartHandler _multipartHandler;

    public DocumentUploadJobController(MultipartHandler multipartHandler)
    {
        _multipartHandler = multipartHandler;
    }
    
    [HttpPost]
    [DisableFormValueModelBinding]
    public async Task<IActionResult> UploadAsync(CancellationToken cancellationToken)
    {
        await using var multipartContent = await _multipartHandler.GetContentAsync(Request, cancellationToken);
        
        // The multipartContent.Data dictionary will contain the data fields from the request
        // The multipartContent.Files dictionary will contain the file fields from the request
        
        return Ok();
    }
}
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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
0.1.0 243 12/9/2023