@@ -18,6 +18,7 @@ import type {
1818SortOrder ,
1919Version ,
2020} from './_types.ts' ;
21+ import { Buffer } from 'node:buffer' ;
2122import { createReadStream , createWriteStream } from 'node:fs' ;
2223import { readFile } from 'node:fs/promises' ;
2324import path from 'node:path' ;
@@ -4166,7 +4167,7 @@ invalid json line
41664167
41674168it ( 'should process large files (600MB+) without RangeError' , async ( ) => {
41684169// Create a realistic JSONL entry similar to actual Claude data (~283 bytes per line)
4169- const sampleEntry = JSON . stringify ( {
4170+ const sampleEntry = ` ${ JSON . stringify ( {
41704171timestamp : '2025-01-10T10:00:00Z' ,
41714172message : {
41724173id : 'msg_01234567890123456789' ,
@@ -4175,7 +4176,7 @@ invalid json line
41754176} ,
41764177requestId : 'req_01234567890123456789' ,
41774178costUSD : 0.01 ,
4178- } ) + '\n' ;
4179+ } ) } \n` ;
41794180
41804181// Target 600MB file (this would cause RangeError with readFile in Node.js)
41814182const targetMB = 600 ;
@@ -4201,7 +4202,7 @@ invalid json line
42014202
42024203// Ensure all data is flushed
42034204await new Promise < void > ( ( resolve , reject ) => {
4204- writeStream . end ( ( err ?: Error | null ) => err ? reject ( err ) : resolve ( ) ) ;
4205+ writeStream . end ( ( err ?: Error | null ) => ( err != null ) ? reject ( err ) : resolve ( ) ) ;
42054206} ) ;
42064207
42074208// Test streaming processing
0 commit comments