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
68.6
Supply Chain
90.7
Quality
74.2
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
768
Last Day
1
Last Week
1
Last Month
10
Last Year
123
MIT License
167 Stars
202 Commits
24 Forks
5 Watchers
3 Branches
16 Contributors
Updated on Jul 04, 2025
Minified
Minified + Gzipped
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%
1
Compared to previous day
Last Week
0%
1
Compared to previous week
Last Month
11.1%
10
Compared to previous month
Last Year
12.8%
123
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
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
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-06-30
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