@ubercode/dcmtk 0.8.2 → 0.9.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/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.cjs +359 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +229 -2
- package/dist/index.d.ts +229 -2
- package/dist/index.js +358 -9
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +16 -3
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.js +18 -4
- 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/servers.js
CHANGED
|
@@ -8,8 +8,9 @@ import { join, normalize } from 'path';
|
|
|
8
8
|
import { existsSync } from 'fs';
|
|
9
9
|
import * as net from 'net';
|
|
10
10
|
import * as fs from 'fs/promises';
|
|
11
|
-
import { copyFile, unlink, stat } from 'fs/promises';
|
|
11
|
+
import { copyFile, unlink, stat, rm, mkdtemp } from 'fs/promises';
|
|
12
12
|
import * as os from 'os';
|
|
13
|
+
import { tmpdir } from 'os';
|
|
13
14
|
import { XMLParser } from 'fast-xml-parser';
|
|
14
15
|
|
|
15
16
|
var __defProp = Object.defineProperty;
|
|
@@ -2282,13 +2283,26 @@ async function tryDirectPath(inputPath, timeoutMs, signal, verbosity) {
|
|
|
2282
2283
|
if (!jsonBinary.ok) {
|
|
2283
2284
|
return err(jsonBinary.error);
|
|
2284
2285
|
}
|
|
2285
|
-
const
|
|
2286
|
-
const
|
|
2286
|
+
const bulkDir = await createBulkTempDir();
|
|
2287
|
+
const directArgs = [...buildVerbosityArgs(verbosity), "+b", "+bd", bulkDir, inputPath];
|
|
2288
|
+
try {
|
|
2289
|
+
const execOpts = signal !== void 0 ? { timeoutMs, signal } : { timeoutMs };
|
|
2290
|
+
return await execAndParse(jsonBinary.value, directArgs, inputPath, execOpts);
|
|
2291
|
+
} finally {
|
|
2292
|
+
rm(bulkDir, { recursive: true, force: true }).catch(() => {
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
}
|
|
2296
|
+
async function createBulkTempDir() {
|
|
2297
|
+
return mkdtemp(join(tmpdir(), "dcm2json-bulk-"));
|
|
2298
|
+
}
|
|
2299
|
+
async function execAndParse(binary, args, inputPath, execOpts) {
|
|
2300
|
+
const result = await execCommand(binary, args, execOpts);
|
|
2287
2301
|
if (!result.ok) {
|
|
2288
2302
|
return err(result.error);
|
|
2289
2303
|
}
|
|
2290
2304
|
if (result.value.exitCode !== 0) {
|
|
2291
|
-
return err(createToolError("dcm2json",
|
|
2305
|
+
return err(createToolError("dcm2json", args, result.value.exitCode, result.value.stderr));
|
|
2292
2306
|
}
|
|
2293
2307
|
try {
|
|
2294
2308
|
const repaired = repairJson(result.value.stdout);
|