is-binary

Detects if a file is binary based on its content

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
is-binary
800.1.010 years ago10 years agoMinified + gzip package size for is-binary in KB

Readme

is-binary
Detects if a file is binary based on its content. build status

Usage

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);

Tests

npm test

Inspiration

Main source code extracted from https://github.com/bevry/istextorbinary/, MIT licensed.
Tests inspired by https://github.com/gjtorikian/isBinaryFile, MIT licensed.

License

MIT http://alessioalex.mit-license.org/