Skip to content

Commit

Permalink
Release 5.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Oct 23, 2024
1 parent 856dfd9 commit 51b8c3a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "isbinaryfile",
"description": "Detects if a file is binary in Node.js. Similar to Perl's -B.",
"version": "5.0.3",
"version": "5.0.4",
"keywords": [
"text",
"binary",
Expand Down
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,14 @@ function isBinaryCheck(fileBuffer: Buffer, bytesRead: number): boolean {
}
} else if (fileBuffer[i] >= 0xf0 && fileBuffer[i] <= 0xf7 && i + 3 < totalBytes) {
i++;
if (fileBuffer[i] >= 0x80 && fileBuffer[i] <= 0xbf && fileBuffer[i + 1] >= 0x80 && fileBuffer[i + 1] <= 0xbf && fileBuffer[i + 2] >= 0x80 && fileBuffer[i + 2] <= 0xbf) {
if (
fileBuffer[i] >= 0x80 &&
fileBuffer[i] <= 0xbf &&
fileBuffer[i + 1] >= 0x80 &&
fileBuffer[i + 1] <= 0xbf &&
fileBuffer[i + 2] >= 0x80 &&
fileBuffer[i + 2] <= 0xbf
) {
i += 2;
continue;
}
Expand Down

0 comments on commit 51b8c3a

Please sign in to comment.