Skip to content

Latest commit

 

History

History
43 lines (29 loc) · 888 Bytes

README.md

File metadata and controls

43 lines (29 loc) · 888 Bytes

file-identity

npm version 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)
}