@ubercode/dcmtk 0.13.2 → 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.js CHANGED
@@ -620,15 +620,17 @@ async function dcm2json(inputPath, options) {
620
620
  }
621
621
  const timeoutMs = options?.timeoutMs ?? DEFAULT_TIMEOUT_MS;
622
622
  const signal = options?.signal;
623
+ const startTime = Date.now();
624
+ const remaining = () => Math.max(1e3, timeoutMs - (Date.now() - startTime));
623
625
  const verbosity = options?.verbosity;
624
626
  if (options?.directOnly === true) {
625
- return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
627
+ return tryDirectPath(inputPath, remaining(), signal, verbosity);
626
628
  }
627
- const xmlResult = await tryXmlPath(inputPath, timeoutMs, signal, buildXmlOpts(options));
629
+ const xmlResult = await tryXmlPath(inputPath, remaining(), signal, buildXmlOpts(options));
628
630
  if (xmlResult.ok) {
629
631
  return xmlResult;
630
632
  }
631
- return tryDirectPath(inputPath, timeoutMs, signal, verbosity);
633
+ return tryDirectPath(inputPath, remaining(), signal, verbosity);
632
634
  }
633
635
  var DcmdumpFormat = {
634
636
  /** Print standard DCMTK format. */