file-identity
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i file-identity

    Weekly Downloads

    2

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    49.3 kB

    Total Files

    17

    Last publish

    Collaborators

    • stonehelei