{
  "name": "isbinaryfile",
  "version": "0.1.9",
  "description": "Detects if a file is binary in Node.js. Similar to Perl's -B.",
  "main": "./lib/panino.js",
  "engines": {
    "node": ">=0.6.0"
  },
  "maintainers": [
    {
      "name": "Garen J. Torikian",
      "email": "gjtorikian@gmail.com"
    }
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/gjtorikian/isBinaryFile"
  },
  "devDependencies": {
    "mocha": ""
  },
  "scripts": {
    "test": "mocha tests/test.js"
  },
  "readme": "isBinaryFile\n============\n\nDetects if a file is binary in Node.js. Similar to [Perl's `-B` switch](http://stackoverflow.com/questions/899206/how-does-perl-know-a-file-is-binary), in that:\n\n* it reads the first few thousand bytes of a file\n* checks for a `null` byte; if it's found, it's binary\n* flags non-ASCII characters. After a certain number of \"weird\" characters, the file is flagged as binary\n\nAll the logic is also pretty much ported from [ag](https://github.com/ggreer/the_silver_searcher).\n\nNote: if the file doesn't exist or it is empty, this function returns `false`.\n\n## Installation\n\n```\nnpm install isBinaryFile\n```\n\n## Usage\n\nIf you pass in one argument, this module assumes it's just the file path, and performs the appropriate file read and stat functionality internally:\n\n```javascript\nvar isBinaryFile = require(\"isbinaryfile\");\n\nif (isBinaryFile(process.argv[2]))\n\tconsole.log(\"It is!\")\nelse\n\tconsole.log(\"No.\")\n```\n\nTa da. \n\n\nHowever, if you've already read and `stat()`-ed a file (for some other reason), you can pass in both the file's raw data and the stat's `size` info to save time:\n\n```javascript\nfs.readFile(process.argv[2], function(err, data) {\n\tfs.lstat(process.argv[2], function(err, stat) {\n\t\tif (isBinaryFile(data, stat))\n\t\t\tconsole.log(\"It is!\")\n\t\telse\n\t\t\tconsole.log(\"No.\")\n\t});\n});\n```\n\n## Testing\n\nInstall mocha on your machine:\n\n```\nnpm install mocha -g\n```\n\nThen go into the _tests_ directory, and type `mocha test.js`.\n",
  "readmeFilename": "README.md",
  "bugs": {
    "url": "https://github.com/gjtorikian/isBinaryFile/issues"
  },
  "homepage": "https://github.com/gjtorikian/isBinaryFile",
  "_id": "isbinaryfile@0.1.9",
  "dist": {
    "shasum": "bdbf435d8cd51b4a250d56d3af9ac700737cf189"
  },
  "_from": "isbinaryfile@~0.1.9",
  "_resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-0.1.9.tgz"
}
