JSPM

is-binary

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9335
  • Score
    100M100P100Q143549F
  • License MIT

Detects if a file is binary based on its content

Package Exports

  • is-binary

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-binary) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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/