Trivial.Mime 6.4.0

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

// Install Trivial.Mime as a Cake Tool
#tool nuget:?package=Trivial.Mime&version=6.4.0

Trivial.Mime

Commonly used MIME content types and its file extension part mapping. Also provide parsers and barcode information generators of Code 128 and EAN-13.

Import

Add following namespace to your code file to use.

using Trivial.Data;
using Trivial.Web;

Content types

Following are the groups of commonly used content type.

  • MimeConstants.Images
  • MimeConstants.Audio
  • MimeConstants.Videos
  • MimeConstants.Documents
  • MimeConstants.Web
  • MimeConstants.Text
  • MimeConstants.Packages
  • MimeConstants.Multipart

File extension mapping

Get MIME by a specific file extension name.

var av1 = MimeConstants.GetByFileExtension(".av1");
var pptx = MimeConstants.GetByFileExtension(".pptx");

EAN

Create 2-, 5-, 8- and 13-bit International Article Number to get its barcode information.

// Parse an EAN-13.
var ean = InternationalArticleNumber.Create("5901234123457");
Console.WriteLine(ean.ToBarcodeString());

// Parse an EAN-13 without checksum.
ean = InternationalArticleNumber.Create("400399415548");
Console.WriteLine(ean.ToString()); // -> 4003994155486
Console.WriteLine(ean.ToPathString()); // Can be used as data of path element of SVG or WPF.

// Parsing an ISBN.
ean = InternationalArticleNumber.Create("978-0-306-40615-7");
Console.WriteLine(ean.ToString()); // -> 9780306406157

// Parsing barcode areas that white represented as 0 and black represented as 1.
ean = InternationalArticleNumber.Create("1010111011011110101100010011001010101000010100111010000101000100101");
Console.WriteLine(ean.ToString()); // -> 73513537

Code 128

Create code 128 to get its barcode information.

// Create by symbol values without checksum.
var code128 = Code128.CreateB(new byte[] { 43, 73, 78, 71, 67, 69, 65, 78 });
Console.WriteLine(code128.ToString()); // -> Kingcean
Console.WriteLine(code128.ToString(Code128.Formats.Hex)); // -> 682b494e474345414e406a
Console.WriteLine(code128.ToBarcodeString());

// Parse a string.
code128 = Code128.CreateA("Trivial libraries");
Console.WriteLine(code128.ToPathString()); // Can be used as data of path element of SVG or WPF.

And for GS1-128.

// Create by an application identifier and its data value.
var ean128 = Code128.CreateGs1(421, "84020500");
Console.WriteLine(ean128.GetAiData().First()); // -> 42184020500
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 is compatible. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
7.2.0 148 11/16/2023
7.1.0 141 5/8/2023
7.0.0 266 1/20/2023
6.6.0 306 11/9/2022
6.5.0 386 6/28/2022
6.4.0 420 4/14/2022
6.3.0 403 3/8/2022
6.2.0 399 1/30/2022
6.1.0 404 1/23/2022
6.0.0 246 1/1/2022
5.2.0 270 12/15/2021
5.1.0 256 12/2/2021
5.0.0 245 11/27/2021
4.0.0 263 11/9/2021
1.0.0 277 8/23/2021