Skip to content

Commit

Permalink
docs(mime): update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Mar 27, 2021
1 parent 88f6165 commit 4afe0f6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/mime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ yarn add @thi.ng/mime
<script src="https://unpkg.com/@thi.ng/mime/lib/index.umd.js" crossorigin></script>
```

Package sizes (gzipped, pre-treeshake): ESM: 4.46 KB / CJS: 4.52 KB / UMD: 4.63 KB
Package sizes (gzipped, pre-treeshake): ESM: 4.52 KB / CJS: 4.58 KB / UMD: 4.68 KB

## Dependencies

Expand Down Expand Up @@ -91,6 +91,19 @@ preferredType("foo", "text/plain")
// "text/plain"
```

Since v0.3.0 reverse lookups are possible too, using `preferredExtension()` (also supports fallback):

```ts
preferredExtension("image/svg+xml");
// "svg"

preferredExtension("image/foo");
// "bin" (default fallback)

preferredExtension("image/foo", "dat");
// "dat" (custom fallback)
```

## Conversion from mime-db

1. Download the [latest version of mime-db's JSON
Expand Down
13 changes: 13 additions & 0 deletions packages/mime/tpl.readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ preferredType("foo", "text/plain")
// "text/plain"
```

Since v0.3.0 reverse lookups are possible too, using `preferredExtension()` (also supports fallback):

```ts
preferredExtension("image/svg+xml");
// "svg"

preferredExtension("image/foo");
// "bin" (default fallback)

preferredExtension("image/foo", "dat");
// "dat" (custom fallback)
```

## Conversion from mime-db

1. Download the [latest version of mime-db's JSON
Expand Down

0 comments on commit 4afe0f6

Please sign in to comment.