mime-tree
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

mime-tree

👋 Intro

A helper for quickly determining the file type of a buffer.

This library is pure JavaScript, any can run in Node, the browser, or anywhere else JavaScript runs. This library is exported in CommonJS and ES Modules.

Compared to other libraries that iterate through multiple arrays to find the mime type, this helper detects mime type by looping through a single object.

Supported File Types

  • JPEG
  • PNG
  • GIF
  • WEBP
  • BMP
  • TIFF
  • AVIF

🚀 How to use

Install

To install this library, use on of the following commands:

npm install -S mime-tree
yarn add mime-tree

Use

import mimeFromBuffer from "mime-tree";

const image: Uint8Array = ...;

const mimeType = mimeFromBuffer(image);

Readme

Keywords

Package Sidebar

Install

npm i mime-tree

Weekly Downloads

764

Version

0.1.4

License

MIT

Unpacked Size

7.87 kB

Total Files

10

Last publish

Collaborators

  • josh-mcfarlin