Trivial.Mime 7.2.0

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

// Install Trivial.Mime as a Cake Tool
#tool nuget:?package=Trivial.Mime&version=7.2.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 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 is compatible.  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. 
.NET Framework net461 is compatible.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 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
8.0.0 105 6/12/2024
7.2.0 173 11/16/2023
7.1.0 189 5/8/2023
7.0.0 286 1/20/2023
6.6.0 336 11/9/2022
6.5.0 399 6/28/2022
6.4.0 446 4/14/2022
6.3.0 435 3/8/2022
6.2.0 414 1/30/2022
6.1.0 416 1/23/2022
6.0.0 268 1/1/2022
5.2.0 299 12/15/2021
5.1.0 280 12/2/2021
5.0.0 273 11/27/2021
4.0.0 292 11/9/2021
1.0.0 312 8/23/2021