Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tada5hi/mime-explorer
A versatile library that simplifies MIME type management, providing a user-friendly interface to effortlessly retrieve MIME types based on file paths/extensions, gather comprehensive meta information, and obtain standard file extensions for a given MIME type.
https://github.com/tada5hi/mime-explorer
content-type content-types mime mime-type mime-types
Last synced: 19 days ago
JSON representation
A versatile library that simplifies MIME type management, providing a user-friendly interface to effortlessly retrieve MIME types based on file paths/extensions, gather comprehensive meta information, and obtain standard file extensions for a given MIME type.
- Host: GitHub
- URL: https://github.com/tada5hi/mime-explorer
- Owner: tada5hi
- License: mit
- Created: 2023-01-12T13:28:17.000Z (almost 2 years ago)
- Default Branch: develop
- Last Pushed: 2024-02-28T01:32:00.000Z (9 months ago)
- Last Synced: 2024-10-12T18:57:39.296Z (about 1 month ago)
- Topics: content-type, content-types, mime, mime-type, mime-types
- Language: TypeScript
- Homepage:
- Size: 1.13 MB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.MD
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# mime-explorer ☂
[![npm version](https://badge.fury.io/js/mime-explorer.svg)](https://badge.fury.io/js/mime-explorer)
[![main](https://github.com/tada5hi/mime-explorer/actions/workflows/main.yml/badge.svg)](https://github.com/tada5hi/mime-explorer/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/tada5hi/mime-explorer/branch/master/graph/badge.svg?token=80LA00PIGM)](https://codecov.io/gh/tada5hi/mime-explorer)
[![Known Vulnerabilities](https://snyk.io/test/github/Tada5hi/mime-explorer/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Tada5hi/mime-explorer?targetFile=package.json)
[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)A versatile library that simplifies MIME type management,
providing a user-friendly interface to effortlessly retrieve MIME types
based on file paths/extensions, gather comprehensive meta information,
and obtain standard file extensions for a given MIME type.It is well-suited for a variety of tasks,
including seamless interaction with HTTP headers and general operations involving files.**Table of Contents**
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)## Installation
```bash
npm install mime-explorer --save
```## Usage
To get the mime type for a given path or extension:
```typescript
import { getType } from 'mime-explorer';getType('txt');
// => 'text/plain'getType('json');
// => 'application/json'
```To get the file extension for a given mime type:
```typescript
import { getExtension } from 'mime-explorer';getExtension('text/plain');
// => 'txt'getExtension('application/json');
// => 'json'
```To get meta information for a mime type:
```typescript
import { get } from 'mime-explorer';get('text/plain');
/*
{
"source": "iana",
"compressible": true,
"extensions": [
"txt",
"text",
"conf",
"def",
"list",
"log",
"in",
"ini"
]
}
*/get('application/json');
/*
{
"source": "iana",
"charset": "UTF-8",
"compressible": true,
"extensions": [
"json",
"map"
]
}
*/
```## License
Made with 💚
Published under [MIT License](./LICENSE).