Skip to content

DialogueConsulting/promise-mmmagic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

promise-mmmagic

Add Promise support for mmmagic.

Installation

npm install promise-mmmagic

or

yarn add promise-mmmagic

Example

const fs = require('fs')
const Magic = require('promise-mmmagic')

const magicFile = 'node_modules/mmmagic/src/binding.cc'

const magic = new Magic(Magic.MAGIC_MIME_TYPE)
// file path
magic
  .detectFile(magicFile)
  .then(result => {
    // text/x-c++
    console.log(result)
  })
// buffer
const buffer = fs.readFileSync(magicFile)
magic
  .detect(buffer)
  .then(result => {
    // text/x-c++
    console.log(result)
  })

Credits

Support

Having trouble? Open an issue!

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%