Trivial.Mime 7.0.0

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

// Install Trivial.Mime as a Cake Tool
#tool nuget:?package=Trivial.Mime&version=7.0.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 Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
Compatible target framework(s)
Additional computed target framework(s)
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.0.0 142 1/20/2023
6.6.0 196 11/9/2022
6.5.0 287 6/28/2022
6.4.0 309 4/14/2022
6.3.0 297 3/8/2022
6.2.0 294 1/30/2022
6.1.0 297 1/23/2022
6.0.0 168 1/1/2022
5.2.0 187 12/15/2021
5.1.0 185 12/2/2021
5.0.0 168 11/27/2021
4.0.0 192 11/9/2021
1.0.0 212 8/23/2021