isbinaryfile
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -20,8 +20,5 @@ "use strict"; | ||
if (isString(file)) { | ||
const filepath = file; | ||
const stat = yield statAsync(filepath); | ||
if (!stat.isFile()) { | ||
throw new Error(`Path provided was not a file!`); | ||
} | ||
const fileDescriptor = yield openAsync(filepath, 'r'); | ||
const stat = yield statAsync(file); | ||
isStatFile(stat); | ||
const fileDescriptor = yield openAsync(file, 'r'); | ||
const allocBuffer = Buffer.alloc(MAX_BYTES); | ||
@@ -54,5 +51,3 @@ // Read the file with no encoding for raw buffer access. | ||
const stat = fs.statSync(file); | ||
if (!stat.isFile()) { | ||
throw new Error(`Path provided was not a file!`); | ||
} | ||
isStatFile(stat); | ||
const fileDescriptor = fs.openSync(file, 'r'); | ||
@@ -142,1 +137,6 @@ const allocBuffer = Buffer.alloc(MAX_BYTES); | ||
} | ||
function isStatFile(stat) { | ||
if (!stat.isFile()) { | ||
throw new Error(`Path provided was not a file!`); | ||
} | ||
} |
{ | ||
"name": "isbinaryfile", | ||
"description": "Detects if a file is binary in Node.js. Similar to Perl's -B.", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"keywords": [ | ||
@@ -24,3 +24,3 @@ "text", | ||
"@types/node": "^10.12.18", | ||
"jest": "^23.6.0", | ||
"jest": "^24.8.0", | ||
"prettier": "^1.15.3", | ||
@@ -27,0 +27,0 @@ "release-it": "^9.6.2", |
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
9992