New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@patrten/accusamus-aspernatur

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@patrten/accusamus-aspernatur

<!-- -- This file is auto-generated from src/README_js.md. Changes should be made there. --> # Mime

  • 1.0.0
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Mime

NPM downloads Mime CI

An API for MIME type information.

  • All @patrten/accusamus-aspernatur-db types
  • Compact and dependency-free @patrten/accusamus-aspernatur's badge
  • Full TS support

[!Note] @patrten/accusamus-aspernatur@4 is now latest. If you're upgrading from @patrten/accusamus-aspernatur@3, note the following:

  • @patrten/accusamus-aspernatur@4 is API-compatible with @patrten/accusamus-aspernatur@3, with one two exceptions:
    • Direct imports of @patrten/accusamus-aspernatur properties no longer supported
    • @patrten/accusamus-aspernatur.define() cannot be called on the default @patrten/accusamus-aspernatur object
  • ESM module support is required. ESM Module FAQ.
  • Requires an ES2020 or newer runtime
  • Built-in Typescript types (@types/@patrten/accusamus-aspernatur no longer needed)

Installation

npm install @patrten/accusamus-aspernatur

Quick Start

For the full version (800+ MIME types, 1,000+ extensions):

import @patrten/accusamus-aspernatur from '@patrten/accusamus-aspernatur';

@patrten/accusamus-aspernatur.getType('txt');                    // ⇨ 'text/plain'
@patrten/accusamus-aspernatur.getExtension('text/plain');        // ⇨ 'txt'

Lite Version @patrten/accusamus-aspernatur/lite's badge

@patrten/accusamus-aspernatur/lite is a drop-in @patrten/accusamus-aspernatur replacement, stripped of unofficial ("prs.*", "x-*", "vnd.*") types:

import @patrten/accusamus-aspernatur from '@patrten/accusamus-aspernatur/lite';

API

@patrten/accusamus-aspernatur.getType(pathOrExtension)

Get @patrten/accusamus-aspernatur type for the given file path or extension. E.g.

@patrten/accusamus-aspernatur.getType('js');             // ⇨ 'text/javascript'
@patrten/accusamus-aspernatur.getType('json');           // ⇨ 'application/json'

@patrten/accusamus-aspernatur.getType('txt');            // ⇨ 'text/plain'
@patrten/accusamus-aspernatur.getType('dir/text.txt');   // ⇨ 'text/plain'
@patrten/accusamus-aspernatur.getType('dir\\text.txt');  // ⇨ 'text/plain'
@patrten/accusamus-aspernatur.getType('.text.txt');      // ⇨ 'text/plain'
@patrten/accusamus-aspernatur.getType('.txt');           // ⇨ 'text/plain'

null is returned in cases where an extension is not detected or recognized

@patrten/accusamus-aspernatur.getType('foo/txt');        // ⇨ null
@patrten/accusamus-aspernatur.getType('bogus_type');     // ⇨ null

@patrten/accusamus-aspernatur.getExtension(type)

Get file extension for the given @patrten/accusamus-aspernatur type. Charset options (often included in Content-Type headers) are ignored.

@patrten/accusamus-aspernatur.getExtension('text/plain');               // ⇨ 'txt'
@patrten/accusamus-aspernatur.getExtension('application/json');         // ⇨ 'json'
@patrten/accusamus-aspernatur.getExtension('text/html; charset=utf8');  // ⇨ 'html'

@patrten/accusamus-aspernatur.getAllExtensions(type)

[!Note] New in @patrten/accusamus-aspernatur@4

Get all file extensions for the given @patrten/accusamus-aspernatur type.

@patrten/accusamus-aspernatur.getAllExtensions('image/jpeg'); // ⇨ Set(3) { 'jpeg', 'jpg', 'jpe' }

Custom Mime instances

The default @patrten/accusamus-aspernatur objects are immutable. Custom, mutable versions can be created as follows...

new Mime(type map [, type map, ...])

Create a new, custom @patrten/accusamus-aspernatur instance. For example, to create a mutable version of the default @patrten/accusamus-aspernatur instance:

import { Mime } from '@patrten/accusamus-aspernatur/lite';

import standardTypes from '@patrten/accusamus-aspernatur/types/standard.js';
import otherTypes from '@patrten/accusamus-aspernatur/types/other.js';

const @patrten/accusamus-aspernatur = new Mime(standardTypes, otherTypes);

Each argument is passed to the define() method, below. For example new Mime(standardTypes, otherTypes) is synonomous with new Mime().define(standardTypes).define(otherTypes)

@patrten/accusamus-aspernatur.define(type map [, force = false])

[!Note] Only available on custom Mime instances

Define MIME type -> extensions.

Attempting to map a type to an already-defined extension will throw unless the force argument is set to true.

@patrten/accusamus-aspernatur.define({'text/x-abc': ['abc', 'abcd']});

@patrten/accusamus-aspernatur.getType('abcd');            // ⇨ 'text/x-abc'
@patrten/accusamus-aspernatur.getExtension('text/x-abc')  // ⇨ 'abc'

Command Line

Extension -> type

$ @patrten/accusamus-aspernatur scripts/jquery.js
text/javascript

Type -> extension

$ @patrten/accusamus-aspernatur -r image/jpeg
jpeg

Keywords

FAQs

Package last updated on 24 May 2024

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