@@ -217,13 +217,15 @@ export class XetBlob extends Blob {
217
217
const termRanges = rangeList . getRanges ( term . range . start , term . range . end ) ;
218
218
219
219
if ( termRanges . every ( ( range ) => range . data ) ) {
220
+ console . log ( "all data available for term" , term . hash , readBytesToSkip ) ;
220
221
rangeLoop: for ( const range of termRanges ) {
221
222
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
222
223
for ( let chunk of range . data ! ) {
223
224
if ( chunk . length > maxBytes - totalBytesRead ) {
224
225
chunk = chunk . slice ( 0 , maxBytes - totalBytesRead ) ;
225
226
}
226
227
totalBytesRead += chunk . length ;
228
+ console . log ( "yield" , chunk . length , "bytes" , "total read" , totalBytesRead ) ;
227
229
// The stream consumer can decide to transfer ownership of the chunk, so we need to return a clone
228
230
// if there's more than one range for the same term
229
231
yield range . refCount > 1 ? chunk . slice ( ) : chunk ;
@@ -250,6 +252,7 @@ export class XetBlob extends Blob {
250
252
251
253
console . log ( "term" , term ) ;
252
254
console . log ( "fetchinfo" , fetchInfo ) ;
255
+ console . log ( "readBytesToSkip" , readBytesToSkip ) ;
253
256
254
257
let resp = await customFetch ( fetchInfo . url , {
255
258
headers : {
@@ -286,7 +289,7 @@ export class XetBlob extends Blob {
286
289
const result = await reader . read ( ) ;
287
290
done = result . done ;
288
291
289
- console . log ( "read" , result . value ?. length , "bytes" , "total read" , totalBytesRead ) ;
292
+ console . log ( "read" , result . value ?. length , "bytes" , "total read" , totalBytesRead , "toSkip" , readBytesToSkip ) ;
290
293
291
294
if ( ! result . value ) {
292
295
continue ;
@@ -312,7 +315,7 @@ export class XetBlob extends Blob {
312
315
uncompressed_length : header . getUint8 ( 5 ) | ( header . getUint8 ( 6 ) << 8 ) | ( header . getUint8 ( 7 ) << 16 ) ,
313
316
} ;
314
317
315
- console . log ( "chunk header" , chunkHeader ) ;
318
+ console . log ( "chunk header" , chunkHeader , "to skip" , readBytesToSkip ) ;
316
319
317
320
if ( chunkHeader . version !== 0 ) {
318
321
throw new Error ( `Unsupported chunk version ${ chunkHeader . version } ` ) ;
0 commit comments