@@ -82,7 +82,7 @@ interface ChunkHeader {
82
82
const CHUNK_HEADER_BYTES = 8 ;
83
83
84
84
// eslint-disable-next-line @typescript-eslint/no-unused-vars
85
- const debug = ( ...args : unknown [ ] ) => { } ;
85
+ const log = ( ...args : unknown [ ] ) => { } ;
86
86
87
87
/**
88
88
* XetBlob is a blob implementation that fetches data directly from the Xet storage
@@ -228,7 +228,7 @@ export class XetBlob extends Blob {
228
228
const termRanges = rangeList . getRanges ( term . range . start , term . range . end ) ;
229
229
230
230
if ( termRanges . every ( ( range ) => range . data ) ) {
231
- debug ( "all data available for term" , term . hash , readBytesToSkip ) ;
231
+ log ( "all data available for term" , term . hash , readBytesToSkip ) ;
232
232
rangeLoop: for ( const range of termRanges ) {
233
233
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
234
234
for ( let chunk of range . data ! ) {
@@ -244,7 +244,7 @@ export class XetBlob extends Blob {
244
244
chunk = chunk . slice ( 0 , maxBytes - totalBytesRead ) ;
245
245
}
246
246
totalBytesRead += chunk . length ;
247
- debug ( "yield" , chunk . length , "bytes" , "total read" , totalBytesRead ) ;
247
+ log ( "yield" , chunk . length , "bytes" , "total read" , totalBytesRead ) ;
248
248
// The stream consumer can decide to transfer ownership of the chunk, so we need to return a clone
249
249
// if there's more than one range for the same term
250
250
yield range . refCount > 1 ? chunk . slice ( ) : chunk ;
@@ -269,9 +269,9 @@ export class XetBlob extends Blob {
269
269
) ;
270
270
}
271
271
272
- debug ( "term" , term ) ;
273
- debug ( "fetchinfo" , fetchInfo ) ;
274
- debug ( "readBytesToSkip" , readBytesToSkip ) ;
272
+ log ( "term" , term ) ;
273
+ log ( "fetchinfo" , fetchInfo ) ;
274
+ log ( "readBytesToSkip" , readBytesToSkip ) ;
275
275
276
276
let resp = await customFetch ( fetchInfo . url , {
277
277
headers : {
@@ -310,7 +310,7 @@ export class XetBlob extends Blob {
310
310
311
311
done = result . done ;
312
312
313
- debug ( "read" , result . value ?. length , "bytes" , "total read" , totalBytesRead , "toSkip" , readBytesToSkip ) ;
313
+ log ( "read" , result . value ?. length , "bytes" , "total read" , totalBytesRead , "toSkip" , readBytesToSkip ) ;
314
314
315
315
if ( ! result . value ) {
316
316
continue ;
@@ -336,7 +336,7 @@ export class XetBlob extends Blob {
336
336
uncompressed_length : header . getUint8 ( 5 ) | ( header . getUint8 ( 6 ) << 8 ) | ( header . getUint8 ( 7 ) << 16 ) ,
337
337
} ;
338
338
339
- debug ( "chunk header" , chunkHeader , "to skip" , readBytesToSkip ) ;
339
+ log ( "chunk header" , chunkHeader , "to skip" , readBytesToSkip ) ;
340
340
341
341
if ( chunkHeader . version !== 0 ) {
342
342
throw new Error ( `Unsupported chunk version ${ chunkHeader . version } ` ) ;
@@ -398,10 +398,10 @@ export class XetBlob extends Blob {
398
398
}
399
399
400
400
if ( uncompressed . length ) {
401
- debug ( "yield" , uncompressed . length , "bytes" , result . value . length , "total read" , totalBytesRead , stored ) ;
401
+ log ( "yield" , uncompressed . length , "bytes" , result . value . length , "total read" , totalBytesRead , stored ) ;
402
402
totalBytesRead += uncompressed . length ;
403
403
yield stored ? uncompressed . slice ( ) : uncompressed ;
404
- debug ( "yielded" , uncompressed . length , "bytes" , result . value . length , "total read" , totalBytesRead ) ;
404
+ log ( "yielded" , uncompressed . length , "bytes" , result . value . length , "total read" , totalBytesRead ) ;
405
405
}
406
406
}
407
407
@@ -410,7 +410,7 @@ export class XetBlob extends Blob {
410
410
}
411
411
}
412
412
413
- debug ( "done" , done , "total read" , totalBytesRead ) ;
413
+ log ( "done" , done , "total read" , totalBytesRead ) ;
414
414
415
415
// Release the reader
416
416
await reader . cancel ( ) ;
0 commit comments