{"name":"mmmagic","version":"0.3.3","author":{"name":"Brian White","email":"mscdex@mscdex.net"},"description":"An async libmagic binding for node.js for detecting content types by data inspection","main":"./index","scripts":{"install":"node-gyp rebuild"},"engines":{"node":">=0.6.0"},"keywords":["magic","libmagic","file","filetype","mime","mimetype"],"licenses":[{"type":"MIT","url":"http://github.com/mscdex/mmmagic/raw/master/LICENSE"}],"repository":{"type":"git","url":"http://github.com/mscdex/mmmagic.git"},"gypfile":true,"bugs":{"url":"https://github.com/mscdex/mmmagic/issues"},"_id":"mmmagic@0.3.3","dist":{"shasum":"804ea0f7b7effefac77bc28ae2731bd8be5799e2","tarball":"http://registry-npm.ywwl.com/mmmagic/download/mmmagic-0.3.3.tgz","integrity":"sha512-UByVQXv3l7rHnfS4HJeVo54jI0fUU8MZVRmS6UDWI2RkROfipeau+dRvheBz208xVl9a5Gb3BdCRyV16rx7Cvw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDjZa0G9YQIOSwjROvKzvtefpjK6dITaBaf2fp5xX70kgIhALMdBezyF1l3F64R72mCZCkupfgWby7n9aUM1qtWYEuB"}],"size":837247,"noattachment":false,"key":"/mmmagic/-/mmmagic-0.3.3.tgz"},"_from":"https://github.com/mscdex/mmmagic/tarball/v0.3.3","_resolved":"https://github.com/mscdex/mmmagic/tarball/v0.3.3","_npmVersion":"1.3.2","_npmUser":{"name":"mscdex","email":"mscdex@mscdex.net"},"maintainers":[{"name":"mscdex","email":"mscdex@mscdex.net"}],"directories":{},"readme":"\nDescription\n===========\n\nAn async libmagic binding for [node.js](http://nodejs.org/) for detecting content types by data inspection.\n\n[![Build Status](https://travis-ci.org/mscdex/mmmagic.svg?branch=master)](https://travis-ci.org/mscdex/mmmagic)\n[![Build status](https://ci.appveyor.com/api/projects/status/mva462lka1ap5a3t)](https://ci.appveyor.com/project/mscdex/mmmagic)\n\n\nRequirements\n============\n\n* [node.js](http://nodejs.org/) -- v4.0.0 or newer\n\n\nInstall\n=======\n\n    npm install mmmagic\n\n\nExamples\n========\n\n* Get general description of a file:\n```javascript\n  var Magic = require('mmmagic').Magic;\n\n  var magic = new Magic();\n  magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err, result) {\n      if (err) throw err;\n      console.log(result);\n      // output on Windows with 32-bit node:\n      //    PE32 executable (DLL) (GUI) Intel 80386, for MS Windows\n  });\n```\n* Get mime type for a file:\n```javascript\n  var mmm = require('mmmagic'),\n      Magic = mmm.Magic;\n\n  var magic = new Magic(mmm.MAGIC_MIME_TYPE);\n  magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err, result) {\n      if (err) throw err;\n      console.log(result);\n      // output on Windows with 32-bit node:\n      //    application/x-dosexec\n  });\n```\n* Get mime type and mime encoding for a file:\n```javascript\n  var mmm = require('mmmagic'),\n      Magic = mmm.Magic;\n\n  var magic = new Magic(mmm.MAGIC_MIME_TYPE | mmm.MAGIC_MIME_ENCODING);\n  // the above flags can also be shortened down to just: mmm.MAGIC_MIME\n  magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err, result) {\n      if (err) throw err;\n      console.log(result);\n      // output on Windows with 32-bit node:\n      //    application/x-dosexec; charset=binary\n  });\n```\n* Get general description of the contents of a Buffer:\n```javascript\n  var Magic = require('mmmagic').Magic;\n\n  var magic = new Magic(),\n        buf = new Buffer('import Options\\nfrom os import unlink, symlink');\n  \n  magic.detect(buf, function(err, result) {\n      if (err) throw err;\n      console.log(result);\n      // output: Python script, ASCII text executable\n  });\n```\n\nAPI\n===\n\nMagic methods\n-------------\n\n* **(constructor)**([< _mixed_ >magicSource][, < _Integer_ >flags]) - Creates and returns a new Magic instance. `magicSource` (if specified) can either be a path string that points to a (compatible) magic file to use *or* it can be a _Buffer_ containing the contents of a (compatible) magic file. If `magicSource` is not a string and not `false`, the bundled magic file will be used. If `magicSource` is `false`, mmmagic will default to searching for a magic file to use (order of magic file searching: `MAGIC` env var -> various file system paths (see `man file`)). flags is a bitmask with the following valid values (available as constants on `require('mmmagic')`):\n\n    * **MAGIC\\_NONE** - No flags set\n    * **MAGIC\\_DEBUG** - Turn on debugging\n    * **MAGIC\\_SYMLINK** - Follow symlinks **(default for non-Windows)**\n    * **MAGIC\\_DEVICES** - Look at the contents of devices\n    * **MAGIC\\_MIME_TYPE** - Return the MIME type\n    * **MAGIC\\_CONTINUE** - Return all matches (returned as an array of strings)\n    * **MAGIC\\_CHECK** - Print warnings to stderr\n    * **MAGIC\\_PRESERVE\\_ATIME** - Restore access time on exit\n    * **MAGIC\\_RAW** - Don't translate unprintable chars\n    * **MAGIC\\_MIME\\_ENCODING** - Return the MIME encoding\n    * **MAGIC\\_MIME** - (**MAGIC\\_MIME\\_TYPE** | **MAGIC\\_MIME\\_ENCODING**)\n    * **MAGIC\\_APPLE** - Return the Apple creator and type\n    * **MAGIC\\_NO\\_CHECK\\_TAR** - Don't check for tar files\n    * **MAGIC\\_NO\\_CHECK\\_SOFT** - Don't check magic entries\n    * **MAGIC\\_NO\\_CHECK\\_APPTYPE** - Don't check application type\n    * **MAGIC\\_NO\\_CHECK\\_ELF** - Don't check for elf details\n    * **MAGIC\\_NO\\_CHECK\\_TEXT** - Don't check for text files\n    * **MAGIC\\_NO\\_CHECK\\_CDF** - Don't check for cdf files\n    * **MAGIC\\_NO\\_CHECK\\_TOKENS** - Don't check tokens\n    * **MAGIC\\_NO\\_CHECK\\_ENCODING** - Don't check text encodings\n\n* **detectFile**(< _String_ >path, < _Function_ >callback) - _(void)_ - Inspects the file pointed at by path. The callback receives two arguments: an < _Error_ > object in case of error (null otherwise), and a < _String_ > containing the result of the inspection.\n\n* **detect**(< _Buffer_ >data, < _Function_ >callback) - _(void)_ - Inspects the contents of data. The callback receives two arguments: an < _Error_ > object in case of error (null otherwise), and a < _String_ > containing the result of the inspection.\n","publish_time":1374531515645,"_cnpm_publish_time":1374531515645,"dist-tags":{"latest":"0.5.3"}}