{"name":"mmmagic","version":"0.4.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":"./lib/index","dependencies":{"nan":"^2.2.1"},"scripts":{"install":"node-gyp rebuild","test":"node test/test.js"},"engines":{"node":">=0.10.0"},"keywords":["magic","libmagic","file","filetype","mime","mimetype"],"licenses":[{"type":"MIT","url":"http://github.com/mscdex/mmmagic/raw/master/LICENSE"}],"repository":{"type":"git","url":"git+ssh://git@github.com/mscdex/mmmagic.git"},"gypfile":true,"bugs":{"url":"https://github.com/mscdex/mmmagic/issues"},"homepage":"https://github.com/mscdex/mmmagic#readme","_id":"mmmagic@0.4.3","_shasum":"49f0085ddb3cdbee01439ec7863a8ce6a91d0276","_resolved":"https://github.com/mscdex/mmmagic/tarball/v0.4.3","_from":"https://github.com/mscdex/mmmagic/tarball/v0.4.3","_npmVersion":"3.8.3","_nodeVersion":"5.10.1","_npmUser":{"name":"mscdex","email":"mscdex@mscdex.net"},"maintainers":[{"name":"mscdex","email":"mscdex@mscdex.net"}],"dist":{"shasum":"49f0085ddb3cdbee01439ec7863a8ce6a91d0276","tarball":"http://registry-npm.ywwl.com/mmmagic/download/mmmagic-0.4.3.tgz","integrity":"sha512-bR4zkWfh4+8q5OErjXQT1WyStdcA1JcxkybmX7J/ANL5WI7cQc0KnRqDsTTf+ukOQ/ijdCTFobhdAFiJoi7g1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICt9V7G7XmWvJPL0KrOTaaLh0j2K57j/B64g2I0hR6v3AiEAk/iy/duIg/vG+RrUnvC4rmhVjVGhUZJN84RqtQv5iY4="}],"size":927246,"noattachment":false,"key":"/mmmagic/-/mmmagic-0.4.3.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/mmmagic-0.4.3.tgz_1461250961771_0.7860816509928554"},"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":1461250963077,"_cnpm_publish_time":1461250963077,"dist-tags":{"latest":"0.5.3"}}