Socket
Socket
Sign inDemoInstall

isbinaryfile

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isbinaryfile - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

9

index.js

@@ -16,6 +16,2 @@ var fs = require('fs');

// NULL byte--it's binary!
if (/\0/.test(bytes))
return true;
var suspicious_bytes = 0;

@@ -30,3 +26,6 @@ var total_bytes = size > 512 ? 512 : size;

for (var i = 0; i < total_bytes; i++) {
if ((bytes[i] < 7 || bytes[i] > 14) && (bytes[i] < 32 || bytes[i] > 127)) {
if (bytes[i] == 0) { // NULL byte--it's binary!
return true;
}
else if ((bytes[i] < 7 || bytes[i] > 14) && (bytes[i] < 32 || bytes[i] > 127)) {
// UTF-8 detection

@@ -33,0 +32,0 @@ if (bytes[i] > 191 && bytes[i] < 224 && i + 1 < total_bytes) {

{
"name": "isbinaryfile",
"version" : "0.1.7",
"version" : "0.1.8",
"description": "Detects if a file is binary in Node.js. Similar to Perl's -B.",

@@ -5,0 +5,0 @@ "main" : "./lib/panino.js",

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