@ubercode/dcmtk 0.8.2 → 0.9.1
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/dicom.cjs +18 -4
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.js +18 -4
- package/dist/dicom.js.map +1 -1
- package/dist/{index-B13DmBRs.d.cts → index-Bq947ilN.d.cts} +1 -0
- package/dist/{index-CCgNgve7.d.ts → index-C9oo35ZO.d.ts} +1 -0
- package/dist/index.cjs +363 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +230 -3
- package/dist/index.d.ts +230 -3
- package/dist/index.js +362 -11
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +20 -5
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.d.cts +1 -1
- package/dist/servers.d.ts +1 -1
- package/dist/servers.js +22 -6
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +18 -3
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.js +18 -3
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/tools.cjs
CHANGED
|
@@ -5,6 +5,8 @@ var child_process = require('child_process');
|
|
|
5
5
|
var kill = require('tree-kill');
|
|
6
6
|
var path = require('path');
|
|
7
7
|
var fs = require('fs');
|
|
8
|
+
var promises = require('fs/promises');
|
|
9
|
+
var os = require('os');
|
|
8
10
|
var stderrLib = require('stderr-lib');
|
|
9
11
|
var fastXmlParser = require('fast-xml-parser');
|
|
10
12
|
|
|
@@ -574,13 +576,26 @@ async function tryDirectPath(inputPath, timeoutMs, signal, verbosity) {
|
|
|
574
576
|
if (!jsonBinary.ok) {
|
|
575
577
|
return err(jsonBinary.error);
|
|
576
578
|
}
|
|
577
|
-
const
|
|
578
|
-
const
|
|
579
|
+
const bulkDir = await createBulkTempDir();
|
|
580
|
+
const directArgs = [...buildVerbosityArgs(verbosity), "+b", "+bd", bulkDir, inputPath];
|
|
581
|
+
try {
|
|
582
|
+
const execOpts = signal !== void 0 ? { timeoutMs, signal } : { timeoutMs };
|
|
583
|
+
return await execAndParse(jsonBinary.value, directArgs, inputPath, execOpts);
|
|
584
|
+
} finally {
|
|
585
|
+
promises.rm(bulkDir, { recursive: true, force: true }).catch(() => {
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
async function createBulkTempDir() {
|
|
590
|
+
return promises.mkdtemp(path.join(os.tmpdir(), "dcm2json-bulk-"));
|
|
591
|
+
}
|
|
592
|
+
async function execAndParse(binary, args, inputPath, execOpts) {
|
|
593
|
+
const result = await execCommand(binary, args, execOpts);
|
|
579
594
|
if (!result.ok) {
|
|
580
595
|
return err(result.error);
|
|
581
596
|
}
|
|
582
597
|
if (result.value.exitCode !== 0) {
|
|
583
|
-
return err(createToolError("dcm2json",
|
|
598
|
+
return err(createToolError("dcm2json", args, result.value.exitCode, result.value.stderr));
|
|
584
599
|
}
|
|
585
600
|
try {
|
|
586
601
|
const repaired = repairJson(result.value.stdout);
|