file-is-binary
Advanced tools
Comparing version 0.1.2 to 0.2.0
22
index.js
'use strict'; | ||
var stat = require('file-stat'); | ||
var isObject = require('isobject'); | ||
@@ -15,3 +16,3 @@ var isBinary = require('isbinaryfile'); | ||
if (file.isNull() || file.isStream() || file.isDirectory()) { | ||
if (isNull(file) || isDirectory(file)) { | ||
file._isBinary = false; | ||
@@ -25,1 +26,20 @@ return false; | ||
}; | ||
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.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.1.2", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/jonschlinkert/file-is-binary", | ||
@@ -25,2 +25,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"dependencies": { | ||
"file-stat": "^0.2.3", | ||
"isbinaryfile": "^3.0.1", | ||
@@ -27,0 +28,0 @@ "isobject": "^2.1.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6785
36
3
+ Addedfile-stat@^0.2.3
+ Addedcore-util-is@1.0.3(transitive)
+ Addedfile-stat@0.2.3(transitive)
+ Addedfs-exists-sync@0.1.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedkind-of@3.2.2(transitive)
+ Addedlazy-cache@2.0.2(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedset-getter@0.1.1(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedthrough2@2.0.5(transitive)
+ Addedto-object-path@0.3.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedxtend@4.0.2(transitive)