Skip to content

Commit

Permalink
docs: add bundlejs badges
Browse files Browse the repository at this point in the history
  • Loading branch information
broofa committed Sep 15, 2023
1 parent 9357ee9 commit bc733b1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 73 deletions.
52 changes: 15 additions & 37 deletions README.md
Expand Up @@ -3,25 +3,23 @@
-->
# Mime

A comprehensive, compact MIME type module.

[![Mime CI](https://github.com/broofa/mime/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/broofa/mime/actions/workflows/ci.yml?query=branch%3Amain)
[![NPM version](https://img.shields.io/npm/v/mime)](https://www.npmjs.com/package/mime)
[![NPM downloads](https://img.shields.io/npm/dm/mime)](https://www.npmjs.com/package/mime)
[![Mime CI](https://github.com/broofa/mime/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/broofa/mime/actions/workflows/ci.yml?query=branch%3Amain)

An API for MIME type information.

- All `mime-db` types
- Compact and dependency-free [![mime's badge](https://deno.bundlejs.com/?q=mime&badge)](https://bundlejs.com/?q=mime)
- Full TS support


> **Important**
> `mime@4` is currently in **beta**. To install:
> ```bash
> npm install mime@beta
> ```
>
> Starting with `mime@4`:
> * ESM module support is required. See the [ESM Module FAQ](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you need CommonJS support (e.g. `require('mime')`), use `mime@3`.
> `mime@4` is currently in **beta**. Changes include:
> * ESM module support is required. See the [ESM Module FAQ](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
> * [ES2020](https://caniuse.com/?search=es2020) support is required
> * Typescript types are built-in. (`@types/mime` is no longer needed)
> * Typescript types are built-in
>
> See [CHANGELOG.md](https://github.com/broofa/mime/blob/main/CHANGELOG.md) for further details
> To install: ` npm install mime@beta`
## Install

```bash
Expand All @@ -39,34 +37,14 @@ mime.getType('txt'); // ⇨ 'text/plain'
mime.getExtension('text/plain'); // ⇨ 'txt'
```

See [Mime API](#mime-api) below for API details.
### Lite Version [![mime/lite's badge](https://deno.bundlejs.com/?q=mime/lite&badge)](https://bundlejs.com/?q=mime/lite)

## Lite Version

The "lite" version of this module omits vendor-specific (`*/vnd.*`) and experimental (`*/x-*`) types. It weighs in at ~2.5KB, compared to 8KB for the full version. To load the lite version:
`mime/lite` is a drop-in `mime` replacement, stripped of unofficial ("`prs.*`", "`x-*`", "`vnd.*`") types:

```javascript
import mime from 'mime/lite';
```

## Mime .vs. mime-types .vs. mime-db modules

For those of you wondering about the difference between these [popular] NPM modules,
here's a brief rundown ...

[`mime-db`](https://github.com/jshttp/mime-db) is "the source of
truth" for MIME type information. It is a dataset (JSON file), not an API, with mime type definitions pulled from a variety of authoritative sources.

[`mime-types`](https://github.com/jshttp/mime-types) is a thin
wrapper around mime-db that provides an API that is mostly-compatible with `mime @ < v1.3.6`.

`mime` (this project) is like `mime-types`, but with the following enhancements:

- Resolves type conflicts (See [mime-score](https://github.com/broofa/mime-score) for details)
- Smaller (`mime` is 2-8KB, `mime-types` is 18KB)
- Zero dependencies
- Built-in TS support

## API

### `mime.getType(pathOrExtension)`
Expand Down Expand Up @@ -159,4 +137,4 @@ mime.getExtension('text/x-abc') // ⇨ 'abc'
jpeg

----
Markdown generated from [src/README_js.md](src/README_js.md) by [![RunMD Logo](https://i.imgur.com/h0FVyzU.png)](https://github.com/broofa/runmd)
Markdown generated from [src/README_js.md](src/README_js.md) by [<img height="13" src="https://camo.githubusercontent.com/5c7c603cd1e6a43370b0a5063d457e0dabb74cf317adc7baba183acb686ee8d0/687474703a2f2f692e696d6775722e636f6d2f634a4b6f3662552e706e67" />](https://github.com/broofa/runmd)
50 changes: 14 additions & 36 deletions docs/README_js.md
Expand Up @@ -4,25 +4,23 @@ runmd.onRequire = (path) => path.replace(/^mime/, '../dist/src/index.js');

# Mime

A comprehensive, compact MIME type module.

[![Mime CI](https://github.com/broofa/mime/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/broofa/mime/actions/workflows/ci.yml?query=branch%3Amain)
[![NPM version](https://img.shields.io/npm/v/mime)](https://www.npmjs.com/package/mime)
[![NPM downloads](https://img.shields.io/npm/dm/mime)](https://www.npmjs.com/package/mime)
[![Mime CI](https://github.com/broofa/mime/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/broofa/mime/actions/workflows/ci.yml?query=branch%3Amain)

An API for MIME type information.

- All `mime-db` types
- Compact and dependency-free [![mime's badge](https://deno.bundlejs.com/?q=mime&badge)](https://bundlejs.com/?q=mime)
- Full TS support


> **Important**
> `mime@4` is currently in **beta**. To install:
> ```bash
> npm install mime@beta
> ```
>
> Starting with `mime@4`:
> * ESM module support is required. See the [ESM Module FAQ](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). If you need CommonJS support (e.g. `require('mime')`), use `mime@3`.
> `mime@4` is currently in **beta**. Changes include:
> * ESM module support is required. See the [ESM Module FAQ](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
> * [ES2020](https://caniuse.com/?search=es2020) support is required
> * Typescript types are built-in. (`@types/mime` is no longer needed)
> * Typescript types are built-in
>
> See [CHANGELOG.md](https://github.com/broofa/mime/blob/main/CHANGELOG.md) for further details
> To install: ` npm install mime@beta`
## Install

```bash
Expand All @@ -40,34 +38,14 @@ mime.getType('txt'); // RESULT
mime.getExtension('text/plain'); // RESULT
```

See [Mime API](#mime-api) below for API details.
### Lite Version [![mime/lite's badge](https://deno.bundlejs.com/?q=mime/lite&badge)](https://bundlejs.com/?q=mime/lite)

### Lite Version

The "lite" version of this module omits vendor-specific (`*/vnd.*`) and experimental (`*/x-*`) types. It weighs in at ~2.5KB, compared to 8KB for the full version. To load the lite version:
`mime/lite` is a drop-in `mime` replacement, stripped of unofficial ("`prs.*`", "`x-*`", "`vnd.*`") types:

```javascript
import mime from 'mime/lite';
```

## Mime .vs. mime-types .vs. mime-db modules

For those of you wondering about the difference between these [popular] NPM modules,
here's a brief rundown ...

[`mime-db`](https://github.com/jshttp/mime-db) is "the source of
truth" for MIME type information. It is a dataset (JSON file), not an API, with mime type definitions pulled from a variety of authoritative sources.

[`mime-types`](https://github.com/jshttp/mime-types) is a thin
wrapper around mime-db that provides an API that is mostly-compatible with `mime @ < v1.3.6`.

`mime` (this project) is like `mime-types`, but with the following enhancements:

- Resolves type conflicts (See [mime-score](https://github.com/broofa/mime-score) for details)
- Smaller (`mime` is 2-8KB, `mime-types` is 18KB)
- Zero dependencies
- Built-in TS support

## API

### `mime.getType(pathOrExtension)`
Expand Down

0 comments on commit bc733b1

Please sign in to comment.