@vpalmisano/webrtcperf 4.1.9 → 4.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/utils.ts CHANGED
@@ -376,6 +376,8 @@ export interface DownloadData {
376
376
  end: number
377
377
  /** Total returned size. */
378
378
  total: number
379
+ /** Content type. */
380
+ contentType: string
379
381
  }
380
382
 
381
383
  /**
@@ -448,12 +450,13 @@ export async function downloadUrl(
448
450
  } else {
449
451
  /* log.debug(`downloadUrl ${response.data.length} bytes, headers=${
450
452
  JSON.stringify(response.headers)}`); */
453
+ const contentType = response.headers['content-type']
451
454
  let start = 0
452
455
  let end = 0
453
456
  let total = 0
454
457
  if (response.headers['content-range']) {
455
- log.debug(`downloadUrl ${response.data.length} bytes, content-range=${response.headers['content-range']}`)
456
458
  const contentRange = response.headers['content-range'].split('/')
459
+ log.debug(`downloadUrl ${response.data.length} bytes, contentType=${contentType}, contentRange=${contentRange}`)
457
460
  const rangeParts = contentRange[0].split('-')
458
461
  total = parseInt(contentRange[1])
459
462
  if (rangeParts.length === 2) {
@@ -471,6 +474,7 @@ export async function downloadUrl(
471
474
  start,
472
475
  end,
473
476
  total,
477
+ contentType,
474
478
  }
475
479
  }
476
480
  }
@@ -609,7 +613,7 @@ SIGNALS.forEach(event =>
609
613
  export async function checkChromeExecutable(): Promise<string> {
610
614
  // eslint-disable-next-line @typescript-eslint/no-require-imports
611
615
  const { loadConfig } = require('./config')
612
- const config = loadConfig()
616
+ const config = await loadConfig()
613
617
  const cacheDir = path.join(os.homedir(), '.webrtcperf/chrome')
614
618
 
615
619
  const fixSemVer = (v: string) => v.split('.').slice(0, 3).join('.')