@ubercode/dcmtk 0.9.1 → 0.9.2
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/{index-Bq947ilN.d.cts → index-BJOfTTB-.d.cts} +2 -0
- package/dist/{index-C9oo35ZO.d.ts → index-DW1uwonV.d.ts} +2 -0
- package/dist/index.cjs +19 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +19 -2
- 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 +19 -2
- package/dist/servers.js.map +1 -1
- package/package.json +1 -1
package/dist/servers.cjs
CHANGED
|
@@ -3235,10 +3235,27 @@ var DicomReceiver = class _DicomReceiver extends events.EventEmitter {
|
|
|
3235
3235
|
/** Moves a received file, opens it as DicomInstance, and emits FILE_RECEIVED. */
|
|
3236
3236
|
async handleFileReceived(worker, data) {
|
|
3237
3237
|
if (worker.associationDir === void 0 || worker.associationId === void 0) return;
|
|
3238
|
-
const srcPath = data.filePath;
|
|
3239
|
-
const destPath = path__namespace.join(worker.associationDir, path__namespace.basename(srcPath));
|
|
3240
3238
|
const assocId = worker.associationId;
|
|
3241
3239
|
const assocDir = worker.associationDir;
|
|
3240
|
+
try {
|
|
3241
|
+
await this.moveAndEmitFile(worker, data, assocId, assocDir);
|
|
3242
|
+
} catch (thrown) {
|
|
3243
|
+
const error = thrown instanceof Error ? thrown : new Error(String(thrown));
|
|
3244
|
+
this.emit("error", {
|
|
3245
|
+
error,
|
|
3246
|
+
filePath: data.filePath,
|
|
3247
|
+
associationId: assocId,
|
|
3248
|
+
associationDir: assocDir,
|
|
3249
|
+
callingAE: data.callingAE,
|
|
3250
|
+
calledAE: data.calledAE,
|
|
3251
|
+
source: data.source
|
|
3252
|
+
});
|
|
3253
|
+
}
|
|
3254
|
+
}
|
|
3255
|
+
/** Inner handler: move file, parse DICOM, emit FILE_RECEIVED or error. */
|
|
3256
|
+
async moveAndEmitFile(worker, data, assocId, assocDir) {
|
|
3257
|
+
const srcPath = data.filePath;
|
|
3258
|
+
const destPath = path__namespace.join(assocDir, path__namespace.basename(srcPath));
|
|
3242
3259
|
const moveResult = await moveFile(srcPath, destPath);
|
|
3243
3260
|
const finalPath = moveResult.ok ? destPath : srcPath;
|
|
3244
3261
|
const fileSize = await statFileSafe(finalPath);
|