0.0.1 • Published 3 years ago

file-identity v0.0.1

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

file-identity

Build Status codecov

The file type is detected by checking the magic number of the buffer.

Install

$ yarn add file-identity
$ npm install file-identity --save

Methods

FT.fromFile(file)
FT.fromBuffer(buffer)

Usage

Take Vue for example

html

<input type="file" @input="handleFileInput" />

js

import FT from 'file-identity'

async handleFileInput(event) {
  const result = await FT.fromFile(event.target.files[0])
  console.log(result)
}