Socket
Socket
Sign inDemoInstall

mime-tree

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mime-tree

A helper for quickly determining the file type of a buffer


Version published
Weekly downloads
1K
decreased by-33.99%
Maintainers
1
Install size
7.69 kB
Created
Weekly downloads
 

Changelog

Source

[0.1.4] - 2022-02-22

Fix

  • Fixed incorrect check implementation

Added

  • Added tests for every image type to verify implementation

Readme

Source

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);

Keywords

FAQs

Last updated on 23 Feb 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc