@ubercode/dcmtk 0.13.1 → 0.14.0

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/dist/tools.cjs CHANGED
@@ -626,15 +626,17 @@ async function dcm2json(inputPath, options) {
626
626
  }
627
627
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
628
628
  const signal = options?.signal;
629
+ const startTime = Date.now();
630
+ const remaining = () => Math.max(1e3, timeoutMs - (Date.now() - startTime));
629
631
  const verbosity = options?.verbosity;
630
632
  if (options?.directOnly === true) {
631
- return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
633
+ return tryDirectPath(inputPath, remaining(), signal, verbosity);
632
634
  }
633
- const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal, buildXmlOpts(options));
635
+ const xmlResult = await tryXmlPath(inputPath, remaining(), signal, buildXmlOpts(options));
634
636
  if (xmlResult.ok) {
635
637
  return xmlResult;
636
638
  }
637
- return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
639
+ return tryDirectPath(inputPath, remaining(), signal, verbosity);
638
640
  }
639
641
  var DcmdumpFormat = {
640
642
  /** Print standard DCMTK format. */