Detects if a file is binary based on its content.
isBinary(content)
Example:
var assert = require('assert');
var fs = require('fs');
var isBinary = require('is-binary');
assert.equal(isBinary(fs.readFileSync('sample.pdf', 'utf8')) === false);
npm test
Main source code extracted from https://github.com/bevry/istextorbinary/, MIT licensed.
Tests inspired by https://github.com/gjtorikian/isBinaryFile, MIT licensed.