# file-is-binary

> Returns true if a file is binary. Checks the actual contents, since extensions are not reliable. Basic wrapper for isbinaryfile to support vinyl files.

Latest version **1.0.0** (published 2017-05-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install file-is-binary
pnpm add file-is-binary
yarn add file-is-binary
bun add file-is-binary
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-05-19 |
| First published | 2016-08-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | binary, file, is, vinyl |

## Links

- npm: https://www.npmjs.com/package/file-is-binary
- Repository: https://github.com/jonschlinkert/file-is-binary
- Issues: https://github.com/jonschlinkert/file-is-binary/issues
- npm.io page: https://npm.io/package/file-is-binary

## Dependencies (2)

- [isobject](https://npm.io/package/isobject.md) ^3.0.0
- [is-binary-buffer](https://npm.io/package/is-binary-buffer.md) ^1.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-05-19
- 0.2.3 — 2017-03-18
- 0.2.2 — 2017-02-03
- 0.2.1 — 2016-08-11
- 0.2.0 — 2016-08-11
- 0.1.2 — 2016-08-11
- 0.1.1 — 2016-08-11
- 0.1.0 — 2016-08-11

## README

# file-is-binary [![NPM version](https://img.shields.io/npm/v/file-is-binary.svg?style=flat)](https://www.npmjs.com/package/file-is-binary) [![NPM monthly downloads](https://img.shields.io/npm/dm/file-is-binary.svg?style=flat)](https://npmjs.org/package/file-is-binary) [![NPM total downloads](https://img.shields.io/npm/dt/file-is-binary.svg?style=flat)](https://npmjs.org/package/file-is-binary) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/file-is-binary.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/file-is-binary)

> Returns true if a file is binary. Checks the actual contents, since extensions are not reliable. Basic wrapper for isbinaryfile to support vinyl files.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save file-is-binary
```

## Usage

Uses [isbinaryfile](https://github.com/gjtorikian/isBinaryFile) to check the file contents and return

```js
var isBinary = require('file-is-binary');

var file = new File({path: 'foo.gif', contents: fs.readFileSync('foo.gif')});
console.log(isBinary(file));

var file = new File({path: 'bar.txt', contents: fs.readFileSync('bar.txt')});
console.log(isBinary(file));
//=> false
```

## About

### Related projects

* [file-contents](https://www.npmjs.com/package/file-contents): Set the `contents` property on a file object. Abstraction from vinyl-fs to support stream or… [more](https://github.com/jonschlinkert/file-contents) | [homepage](https://github.com/jonschlinkert/file-contents "Set the `contents` property on a file object. Abstraction from vinyl-fs to support stream or non-stream usage.")
* [file-stat](https://www.npmjs.com/package/file-stat): Set the `stat` property on a file object. Abstraction from vinyl-fs to support stream or… [more](https://github.com/jonschlinkert/file-stat) | [homepage](https://github.com/jonschlinkert/file-stat "Set the `stat` property on a file object. Abstraction from vinyl-fs to support stream or non-stream usage.")
* [gulp-is-binary](https://www.npmjs.com/package/gulp-is-binary): Adds an `.isBinary()` function to the `file` object, similar to `file.isNull()` and `file.isStream()`. | [homepage](https://github.com/jonschlinkert/gulp-is-binary "Adds an `.isBinary()` function to the `file` object, similar to `file.isNull()` and `file.isStream()`.")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.

### Building docs

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

### Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 19, 2017._

---
_Source: https://npm.io/package/file-is-binary · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
