Skip to content

Commit 8d87ded

Browse files
committed
Fix long first lines causing hanging (#41)
1 parent 65c105f commit 8d87ded

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## Next
4+
- Fixed files with long first lines causing lag ([#41](https://github.com/Nixinova/LinguistJS/issues/41)).
5+
36
## 2.9.1
47
*2025-04-04*
58
- Added CLI error message when passing invalid category input.

src/helpers/read-file.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default async function readFileChunk(filename: string, onlyFirstLine: boo
1010
let content = '';
1111
for await (const data of stream) { // may throw
1212
content += data.toString();
13-
if (onlyFirstLine && content.includes('\n')) {
13+
if (onlyFirstLine) {
1414
return content.split(/\r?\n/)[0];
1515
}
1616
}

0 commit comments

Comments
 (0)