Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@allegiant/mime

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@allegiant/mime

Simple mime library.

  • 0.2.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
2
Weekly downloads
 
Created
Source

mime

Simple mime type library. Can be used standalone or as a module for the allegiant app framework.

There be 🐲 here! The API and functionality are being cemented, anything before a 1.0.0 release is subject to change.

Npm Version Build Status Coverage Status

Installation

npm install @allegiant/mime --save

Usage

const Mime = require('@allegiant/mime');

var mime = new Mime();
// Alternatively; mime = new Mime('text/plain') to specify the expected default mime type returned on type queries

// Default mime type for unknown type queries
console.log("Default Mime Type: ", mime.type());

// mime.type Accepts file extensions with or without a '.' 
console.log("Mime type for: .txt", "-", mime.type(".txt"));
console.log("Alternative extension: txt", "-", mime.type("txt"));

// Can be used to generate content-type headers with the encoding specified
console.log("Content-Type:", mime.type(".txt", 'utf8'));

// Find extensions for a known mime type
console.log("Known extensions for Mime Type: 'text/html' =", mime.ext("text/html"));

// Unknown mime types always return '' for an extension query
console.log("Extensions for Unknown Mime Type: 'unknowntype' = '" + mime.ext("unknowntype") + "'");

Copyright © 2017 Allegiant. Distributed under the terms of the MIT License, see LICENSE

Availble via npm or github.

FAQs

Package last updated on 29 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc