Skip to content

Commit 83df85b

Browse files
committed
fix(stream): Buffer‑Chunks beim Stream‑Lesen großer Dateien korrekt behandeln 🐛
chore(deps): Version auf 1.17.1 erhöht & package-lock.json regeneriert 🔒
1 parent 970057f commit 83df85b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/helpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,8 +634,9 @@ async function readLargeFileAsync(filePath: string): Promise<string> {
634634
const chunks: string[] = [];
635635
const stream = fs.createReadStream(filePath, { encoding: 'utf8' });
636636

637-
stream.on('data', (chunk: string) => {
638-
chunks.push(chunk);
637+
stream.on('data', (chunk: string | Buffer) => {
638+
const chunkStr = typeof chunk === 'string' ? chunk : chunk.toString();
639+
chunks.push(chunkStr);
639640
});
640641

641642
stream.on('end', () => {

0 commit comments

Comments
 (0)