Gathering detailed insights and metrics for @aleclarson/isbinaryfile
Gathering detailed insights and metrics for @aleclarson/isbinaryfile
Gathering detailed insights and metrics for @aleclarson/isbinaryfile
Gathering detailed insights and metrics for @aleclarson/isbinaryfile
Detects if a file is binary in Node.js. Similar to Perl's -B
npm install @aleclarson/isbinaryfile
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
167 Stars
202 Commits
24 Forks
5 Watchers
3 Branches
16 Contributors
Updated on Jul 04, 2025
Latest Version
3.0.2
Package Id
@aleclarson/isbinaryfile@3.0.2
Unpacked Size
7.27 kB
Size
2.88 kB
File Count
4
NPM Version
6.1.0
Node Version
10.7.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
5
Detects if a file is binary in Node.js. Similar to Perl's -B
switch, in that:
null
byte; if it's found, it's binaryMuch of the logic is pretty much ported from ag.
Note: if the file doesn't exist, is a directory, or is empty, the function returns false
.
npm install isbinaryfile
filepath
, a string
indicating the path to the file.callback
, a function
for the callback. It has two arguments:
err
, the typical Node.js error argumentresult
, a boolean
of true
or false
, depending on if the file is binarybytes
, a Buffer
of the file's contents.size
, an optional number
indicating the file size.callback
, a function
for the callback. It has two arguments:
err
, the typical Node.js error argumentresult
, a boolean
of true
or false
, depending on if the file is binaryfilepath
, a string
indicating the path to the file.bytes
, a Buffer
of the file's contents.size
, an number
indicating the file size.Returns a boolean
of true
or false
, depending on if the file is binary.
1var isBinaryFile = require("isbinaryfile"); 2 3fs.readFile("some_file", function(err, data) { 4 fs.lstat("some_file", function(err, stat) { 5 isBinaryFile(data, stat.size, function (err, result) { 6 if (!err) { 7 if (result) { 8 console.log("It is!") 9 } 10 else { 11 console.log("No.") 12 } 13 } 14 }); 15 }); 16}); 17 18isBinaryFile.sync("some_file"); // true or false 19var bytes = fs.readFileSync(("some_file")); 20var size = fs.lstatSync(("some_file").size; 21isBinaryFile.sync(bytes, size); // true or false
Run npm install
to install mocha
, then run npm test
.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
7 existing vulnerabilities detected
Details
Reason
Found 2/10 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More