file-identity
v0.0.1
Published
The file type is detected by checking the magic number of the buffer.
Downloads
18
Readme
file-identity
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)
}