https://github.com/zeachco/real-mime-type
MIME types (IANA media types) can be wrong when the user changes the file extension, this package reads the first bytes of the file to ensure they fit the expectations and reverts to default browser mime types when unsupported
https://github.com/zeachco/real-mime-type
binary binary-search deno file-upload filereader-api mime mime-types npm-package
Last synced: 27 days ago
JSON representation
MIME types (IANA media types) can be wrong when the user changes the file extension, this package reads the first bytes of the file to ensure they fit the expectations and reverts to default browser mime types when unsupported
- Host: GitHub
- URL: https://github.com/zeachco/real-mime-type
- Owner: zeachco
- License: gpl-3.0
- Created: 2023-05-08T20:38:25.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-10T17:41:43.000Z (about 3 years ago)
- Last Synced: 2025-02-12T20:22:38.247Z (over 1 year ago)
- Topics: binary, binary-search, deno, file-upload, filereader-api, mime, mime-types, npm-package
- Language: TypeScript
- Homepage:
- Size: 121 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# real-mime-type
MIME types (IANA media types) can be wrong when the user changes the file
extension, this package reads the first bytes of the file to ensure they fit the
expectations and reverts to default browser mime types when unsupported
## targets
This package is built using Deno but targets Deno, NPM and ESM
## Generate lib
```bash
deno task dev` for watch mode
```
or
```bash
deno task build` for ci
```
## Demo
https://stackblitz.com/edit/react-ts-eqqh3x?file=App.tsx,UploadValidator.tsx
## NPM Package
[@zeachco/real-mime-types](https://www.npmjs.com/package/@zeachco/real-mime-types)
Publish is public (`npm publish --access public`)
## Contributions to package it properly are welcome