isbinaryfile
Advanced tools
Comparing version 3.0.2 to 3.0.3
var fs = require('fs'); | ||
var path = require("path"); | ||
var path = require('path'); | ||
var alloc = require('buffer-alloc'); | ||
var MAX_BYTES = 512; | ||
@@ -16,3 +17,3 @@ | ||
if (r_err) return cb(r_err); | ||
bytes = new Buffer(MAX_BYTES); | ||
bytes = alloc(MAX_BYTES); | ||
// Read the file with no encoding for raw buffer access. | ||
@@ -120,3 +121,3 @@ fs.read(descriptor, bytes, 0, bytes.length, 0, function(err, size, bytes){ | ||
// Read the file with no encoding for raw buffer access. | ||
bytes = new Buffer(MAX_BYTES); | ||
bytes = alloc(MAX_BYTES); | ||
size = fs.readSync(descriptor, bytes, 0, bytes.length, 0); | ||
@@ -123,0 +124,0 @@ } finally { |
{ | ||
"name": "isbinaryfile", | ||
"description": "Detects if a file is binary in Node.js. Similar to Perl's -B.", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"dependencies": { | ||
"buffer-alloc": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
@@ -6,0 +9,0 @@ "mocha": "^2.2.4", |
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
7437
113
1
+ Addedbuffer-alloc@^1.2.0
+ Addedbuffer-alloc@1.2.0(transitive)
+ Addedbuffer-alloc-unsafe@1.1.0(transitive)
+ Addedbuffer-fill@1.0.0(transitive)