Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

file-is-binary

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-is-binary - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

28

index.js
'use strict';
var stat = require('file-stat');
var isObject = require('isobject');

@@ -16,3 +15,3 @@ var isBinary = require('isbinaryfile');

if (isObject(file.contents) && typeof file.pipe === 'function') {
if (typeof file.isStream === 'function' && file.isStream()) {
file._isBinary = false;

@@ -22,3 +21,3 @@ return false;

if (isNull(file) || isDirectory(file)) {
if (typeof file.isNull === 'function' && file.isNull()) {
file._isBinary = false;

@@ -28,2 +27,7 @@ return false;

if (typeof file.isDirectory === 'function' && file.isDirectory()) {
file._isBinary = false;
return false;
}
var len = file.stat ? file.stat.size : file.contents.length;

@@ -34,19 +38,1 @@ file._isBinary = isBinary.sync(file.contents, len);

function isNull(file) {
if (typeof file.isNull !== 'function') {
file.isNull = function() {
return file.contents === null;
};
}
return file.isNull();
}
function isDirectory(file) {
if (typeof file.stat === 'undefined') {
stat.statSync(file);
file.isDirectory = function() {
return file.stat && file.stat.isDirectory();
}
}
return file.isDirectory();
}
{
"name": "file-is-binary",
"description": "Returns true if a file is binary. Checks the actual contents, since extensions are not reliable. Basic wrapper for isbinaryfile to support vinyl files.",
"version": "0.2.2",
"version": "0.2.3",
"homepage": "https://github.com/jonschlinkert/file-is-binary",

@@ -23,3 +23,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"dependencies": {
"file-stat": "^1.0.0",
"isbinaryfile": "^3.0.2",

@@ -36,3 +35,4 @@ "isobject": "^3.0.0"

"file",
"is"
"is",
"vinyl"
],

@@ -39,0 +39,0 @@ "verb": {

@@ -1,4 +0,4 @@

# 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 downloads](https://img.shields.io/npm/dm/file-is-binary.svg?style=flat)](https://npmjs.org/package/file-is-binary) [![Build Status](https://img.shields.io/travis/jonschlinkert/file-is-binary.svg?style=flat)](https://travis-ci.org/jonschlinkert/file-is-binary)
# 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.
> Returns true if a file is binary. Checks the actual contents, since extensions are not reliable. Basic wrapper for isbinaryfile to support vinyl files.

@@ -40,12 +40,12 @@ ## Install

Please read the [contributing guide](contributing.md) for avice on opening issues, pull requests, and coding standards.
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
### Building docs
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
_(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 and API documentation with [verb](https://github.com/verbose/verb):
To generate the readme, run the following command:
```sh
$ npm install -g verb verb-generate-readme && verb
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

@@ -55,6 +55,6 @@

Install dev dependencies:
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 -d && npm test
$ npm install && npm test
```

@@ -67,11 +67,11 @@

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### License
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/file-is-binary/blob/master/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.1.30, on August 11, 2016._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on March 18, 2017._
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc