@@ -284,32 +284,36 @@ export const listArchive =
284
284
name : string ;
285
285
} ;
286
286
287
+ // let beginningDone = false;
288
+
287
289
let entries : Entry [ ] = [ ] ;
288
290
289
291
if ( buffer . length > 0 ) {
290
292
data = buffer + data ;
291
293
buffer = '' ;
292
294
}
293
295
296
+ const params = {
297
+ path : 'Path = ' ,
298
+ type : 'Type = ' ,
299
+ method : 'Method = ' ,
300
+ physicalSize : 'Physical Size = ' ,
301
+ headersSize : 'Headers Size = ' ,
302
+ } ;
303
+
294
304
data . split ( '\n' ) . forEach ( function ( line ) {
295
305
// Populate the tech specs of the archive that are passed to the
296
306
// resolve handler.
297
- if ( line . substr ( 0 , 7 ) === 'Path = ' ) {
298
- spec . path = line . substr ( 7 , line . length ) ;
299
- } else if ( line . substr ( 0 , 7 ) === 'Type = ' ) {
300
- spec . type = line . substr ( 7 , line . length ) ;
301
- } else if ( line . substr ( 0 , 9 ) === 'Method = ' ) {
302
- spec . method = line . substr ( 9 , line . length ) ;
303
- } else if ( line . substr ( 0 , 16 ) === 'Physical Size = ' ) {
304
- spec . physicalSize = parseInt (
305
- line . substr ( 16 , line . length ) ,
306
- 10
307
- ) ;
308
- } else if ( line . substr ( 0 , 15 ) === 'Headers Size = ' ) {
309
- spec . headersSize = parseInt (
310
- line . substr ( 15 , line . length ) ,
311
- 10
312
- ) ;
307
+ if ( line . startsWith ( params . path ) ) {
308
+ spec . path = line . slice ( params . path . length ) ;
309
+ } else if ( line . startsWith ( params . type ) ) {
310
+ spec . type = line . slice ( params . type . length ) ;
311
+ } else if ( line . startsWith ( params . method ) ) {
312
+ spec . method = line . slice ( params . method . length ) ;
313
+ } else if ( line . startsWith ( params . physicalSize ) ) {
314
+ spec . physicalSize = parseInt ( line . slice ( params . physicalSize . length ) , 10 ) ;
315
+ } else if ( line . startsWith ( params . headersSize ) ) {
316
+ spec . headersSize = parseInt ( line . slice ( params . headersSize . length ) , 10 ) ;
313
317
} else {
314
318
// Parse the stdout to find entries
315
319
let res = regex . exec ( line ) ;
0 commit comments