1.0.3 • Published 2 years ago

type-files v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

type-files

Detect the file type of a base64 The file type is detected by checking the magic number of the base64.

This package is for detecting bas64 based file formats, not binary based formats.

Install

npm install type-files

Usage

Node.js

Determine file type from a file:

import {detectMimeType} from 'type-files';
console.log(detectMimeType('iVBORw0KGgoAAAANSUhEUgAAAAEAAAAB'));
//=> {ext: 'png', mime: 'image/png'}