VOOZH about

URL: https://www.nuget.org/packages/HttpMultipartParser/

⇱ NuGet Gallery | HttpMultipartParser 10.0.0




HttpMultipartParser 10.0.0

dotnet add package HttpMultipartParser --version 10.0.0
 
 
NuGet\Install-Package HttpMultipartParser -Version 10.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="HttpMultipartParser" Version="10.0.0" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HttpMultipartParser" Version="10.0.0" />
 
Directory.Packages.props
<PackageReference Include="HttpMultipartParser" />
 
Project file
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 HttpMultipartParser --version 10.0.0
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: HttpMultipartParser, 10.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 HttpMultipartParser@10.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=HttpMultipartParser&version=10.0.0
 
Install as a Cake Addin
#tool nuget:?package=HttpMultipartParser&version=10.0.0
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Http Multipart Parser

👁 License
👁 Sourcelink
👁 Build status
👁 tests
👁 Coverage Status
👁 CodeFactor

Release Notes NuGet (stable) MyGet (prerelease)
👁 GitHub release
👁 Nuget
👁 MyGet Pre Release

About

The Http Multipart Parser does it exactly what it claims on the tin: parses multipart/form-data. This particular parser is well suited to parsing large data from streams as it doesn't attempt to read the entire stream at once and procudes a set of streams for file data.

Installation

The easiest way to include HttpMultipartParser in your project is by adding the nuget package to your project:

PM> Install-Package HttpMultipartParser

.NET framework suport

  • The parser currently supports .NET framework 4.8 and any framework supporting .NET Standard 2.1 (which includes .NET 5.0 and all subsequent versions as well as some legacy versions such as .NET Core 3.x and ASP.NET Core 3.x).
  • Version 5.1.0 was the last version that supported .NET 4.6.1, NET 4.7.2 and .NET standard 2.0.
  • Version 2.2.4 was the last version that supported older .NET platforms such as .NET 4.5 and .NET standard 1.3.

Usage

Non-Streaming (Simple, don't use on very large files)

  1. Parse the stream containing the multipart/form-data by invoking MultipartFormDataParser.Parse (or it's asynchronous counterpart MultipartFormDataParser.ParseAsync).
  2. Access the data through the parser.

Streaming (Handles large files)

  1. Create a new StreamingMultipartFormDataParser with the stream containing the multipart/form-data
  2. Set up the ParameterHandler and FileHandler delegates
  3. Call parser.Run() (or it's asynchronous counterpart parser.RunAsync())
  4. The delegates will be called as data streams in.

Examples

Single file

// stream:
-----------------------------41952539122868
Content-Disposition: form-data; name="username"

example
-----------------------------41952539122868
Content-Disposition: form-data; name="email"

example@data.com
-----------------------------41952539122868
Content-Disposition: form-data; name="files[]"; filename="photo1.jpg"
Content-Type: image/jpeg

ExampleBinaryData012031203
-----------------------------41952539122868--
// ===== Simple Parsing ====
// You can parse synchronously:
var parser = MultipartFormDataParser.Parse(stream);

// Or you can parse asynchronously:
var parser = await MultipartFormDataParser.ParseAsync(stream).ConfigureAwait(false);

// From this point the data is parsed, we can retrieve the
// form data using the GetParameterValue method.
var username = parser.GetParameterValue("username");
var email = parser.GetParameterValue("email");

// Files are stored in a list:
var file = parser.Files.First();
string filename = file.FileName;
Stream data = file.Data;

// ==== Advanced Parsing ====
var parser = new StreamingMultipartFormDataParser(stream);
parser.ParameterHandler += parameter => DoSomethingWithParameter(parameter);
parser.FileHandler += (name, fileName, type, disposition, buffer, bytes, partNumber, additionalProperties) =>
{
 // Write the part of the file we've received to a file stream. (Or do something else)
 filestream.Write(buffer, 0, bytes);
};

// You can parse synchronously:
parser.Run();

// Or you can parse asynchronously:
await parser.RunAsync().ConfigureAwait(false);

Multiple Parameters

// stream:
-----------------------------41952539122868
Content-Disposition: form-data; name="checkbox"

likes_cake
-----------------------------41952539122868
Content-Disposition: form-data; name="checkbox"

likes_cookies
-----------------------------41952539122868--
// ===== Simple Parsing ====
// You can parse synchronously:
var parser = MultipartFormDataParser.Parse(stream);

// Or you can parse asynchronously:
var parser = await MultipartFormDataParser.ParseAsync(stream).ConfigureAwait(false);

// From this point the data is parsed, we can retrieve the
// form data from the GetParameterValues method
var checkboxResponses = parser.GetParameterValues("checkbox");
foreach(var parameter in checkboxResponses)
{
 Console.WriteLine("Parameter {0} is {1}", parameter.Name, parameter.Data)
}

Multiple Files

// stream:
-----------------------------41111539122868
Content-Disposition: form-data; name="files[]"; filename="photo1.jpg"
Content-Type: image/jpeg

MoreBinaryData
-----------------------------41111539122868
Content-Disposition: form-data; name="files[]"; filename="photo2.jpg"
Content-Type: image/jpeg

ImagineLotsOfBinaryData
-----------------------------41111539122868--
// ===== Simple Parsing ====
// You can parse synchronously:
var parser = MultipartFormDataParser.Parse(stream);

// Or you can parse asynchronously:
var parser = await MultipartFormDataParser.ParseAsync(stream).ConfigureAwait(false);

// Loop through all the files
foreach(var file in parser.Files)
{
 Stream data = file.Data;

 // Do stuff with the data.
}

// ==== Advanced Parsing ====
var parser = new StreamingMultipartFormDataParser(stream);
parser.ParameterHandler += parameter => DoSomethingWithParameter(parameter);
parser.FileHandler += (name, fileName, type, disposition, buffer, bytes, partNumber, additionalProperties) =>
{
 // Write the part of the file we've received to a file stream. (Or do something else)
 // Assume that filesreamsByName is a Dictionary<string, FileStream> of all the files
 // we are writing.
 filestreamsByName[name].Write(buffer, 0, bytes);
};
parser.StreamClosedHandler += () 
{
 // Do things when my input stream is closed
};

// You can parse synchronously:
parser.Run();

// Or you can parse asynchronously:
await parser.RunAsync().ConfigureAwait(false);

Licensing

This project is licensed under MIT.

Product Versions Compatible and additional computed target framework versions.
.NET net5.0 net5.0 was computed.  net5.0-windows net5.0-windows was computed.  net6.0 net6.0 was computed.  net6.0-android net6.0-android was computed.  net6.0-ios net6.0-ios was computed.  net6.0-maccatalyst net6.0-maccatalyst was computed.  net6.0-macos net6.0-macos was computed.  net6.0-tvos net6.0-tvos was computed.  net6.0-windows net6.0-windows was computed.  net7.0 net7.0 was computed.  net7.0-android net7.0-android was computed.  net7.0-ios net7.0-ios was computed.  net7.0-maccatalyst net7.0-maccatalyst was computed.  net7.0-macos net7.0-macos was computed.  net7.0-tvos net7.0-tvos was computed.  net7.0-windows net7.0-windows was computed.  net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 was computed.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 was computed.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
.NET Core netcoreapp2.0 netcoreapp2.0 was computed.  netcoreapp2.1 netcoreapp2.1 was computed.  netcoreapp2.2 netcoreapp2.2 was computed.  netcoreapp3.0 netcoreapp3.0 was computed.  netcoreapp3.1 netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 netstandard2.0 is compatible.  netstandard2.1 netstandard2.1 was computed. 
.NET Framework net461 net461 was computed.  net462 net462 was computed.  net463 net463 was computed.  net47 net47 was computed.  net471 net471 was computed.  net472 net472 was computed.  net48 net48 was computed.  net481 net481 was computed. 
MonoAndroid monoandroid monoandroid was computed. 
MonoMac monomac monomac was computed. 
MonoTouch monotouch monotouch was computed. 
Tizen tizen40 tizen40 was computed.  tizen60 tizen60 was computed. 
Xamarin.iOS xamarinios xamarinios was computed. 
Xamarin.Mac xamarinmac xamarinmac was computed. 
Xamarin.TVOS xamarintvos xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (45)

Showing the top 5 NuGet packages that depend on HttpMultipartParser:

Package Downloads
StrongGrid

StrongGrid is a strongly typed .NET client for SendGrid's v3 API.

ZoomNet

ZoomNet is a strongly typed .NET client for Zoom's API.

Pangea.SDK

.NET SDK to access Pangea API services on pangea.cloud

IctBaden.Stonehenge3

X-Platform Web Application Framework

IctBaden.Stonehenge4

X-Platform Web MVVM Application Framework

GitHub repositories (10)

Showing the top 10 popular GitHub repositories that depend on HttpMultipartParser:

Repository Stars
restsharp/RestSharp
Simple REST and HTTP API Client for .NET
sendgrid/sendgrid-csharp
The Official Twilio SendGrid C#, .NetStandard, .NetCore API Library
Decimation/SmartImage
Reverse image search tool (SauceNao, IQDB, Ascii2D, trace.moe, and more)
uholeschak/ediabaslib
.NET BMW and VAG Ediabas interpreter library
bassmaster187/TeslaLogger
TeslaLogger is a self hosted data logger for your Tesla Model S/3/X/Y. Actually it supports RaspberryPi 3B, 3B+, 4B, Docker and Synology NAS.
DataDog/dd-trace-dotnet
.NET Client Library for Datadog APM
Jericho/StrongGrid
Strongly typed library for the entire SendGrid v3 API, including webhooks
daohainam/mini-web-server
A simple but full-featured web server, supports HTTP/1, HTTP/2, MVC, API, Authentication, Authorization...
yahehe/Nancy.Swagger
Nancy plugin for generated API documentation in Swagger format.
scottoffen/grapevine
Fast, unopinionated, embeddable, minimalist web framework for .NET
Version Downloads Last Updated
10.0.0 229,316 3/2/2026
9.2.0 278,176 11/13/2025
9.1.0 224,642 9/1/2025
9.0.0 1,284,828 1/29/2025
8.4.0 2,592,312 4/8/2024
8.3.0 978,164 1/10/2024
8.2.0 782,653 6/22/2023
8.1.0 584,129 2/5/2023
8.0.0 414,157 1/8/2023
7.1.0 365,644 10/30/2022
7.0.0 344,923 7/7/2022
6.0.1 79,846 5/31/2022
5.1.0 1,394,424 3/5/2022
5.0.1 5,358,172 7/11/2021
5.0.0 2,073,660 1/3/2021
4.4.0 102,571 12/4/2020
4.3.1 727,135 5/1/2020
4.3.0 3,332 5/1/2020
4.2.0 78,980 3/30/2020
4.1.0 6,559 3/22/2020
Loading failed