dcmjs 0.49.2 → 0.49.3
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/build/dcmjs.es.js +45 -6
- package/build/dcmjs.es.js.map +1 -1
- package/build/dcmjs.js +45 -6
- package/build/dcmjs.js.map +1 -1
- package/build/dcmjs.min.js +1 -1
- package/build/dcmjs.min.js.map +1 -1
- package/package.json +1 -1
package/build/dcmjs.es.js
CHANGED
|
@@ -12672,6 +12672,14 @@ var DicomMetadataListener = /*#__PURE__*/function () {
|
|
|
12672
12672
|
_defineProperty(this, "dict", null);
|
|
12673
12673
|
_defineProperty(this, "filters", []);
|
|
12674
12674
|
_defineProperty(this, "information", null);
|
|
12675
|
+
/**
|
|
12676
|
+
* Optional backpressure (drain) function. When set, the reader will await
|
|
12677
|
+
* the returned promise before emitting more fragment values, to avoid
|
|
12678
|
+
* having too many open streams or overwhelming the consumer.
|
|
12679
|
+
*/
|
|
12680
|
+
_defineProperty(this, "_drain", function () {
|
|
12681
|
+
return Promise.resolve();
|
|
12682
|
+
});
|
|
12675
12683
|
// Handle legacy constructor format where first arg might be a filter
|
|
12676
12684
|
if (typeof options.addTag === "function" || typeof options.startObject === "function" || typeof options.pop === "function" || typeof options.value === "function") {
|
|
12677
12685
|
// Legacy format: all arguments are filters
|
|
@@ -12696,6 +12704,33 @@ var DicomMetadataListener = /*#__PURE__*/function () {
|
|
|
12696
12704
|
* @returns {void}
|
|
12697
12705
|
*/
|
|
12698
12706
|
_createClass(DicomMetadataListener, [{
|
|
12707
|
+
key: "setDrain",
|
|
12708
|
+
value:
|
|
12709
|
+
/**
|
|
12710
|
+
* Set the drain (pushback) function for backpressure. The function should
|
|
12711
|
+
* return a Promise that resolves when it is safe to emit more data (e.g.
|
|
12712
|
+
* when unsettled stream write count is below a limit). Node.js streams use
|
|
12713
|
+
* the term "drain" for this (see Writable 'drain' event).
|
|
12714
|
+
*
|
|
12715
|
+
* @param {(() => Promise<void>) | null} fn - Function that returns a Promise, or null to clear
|
|
12716
|
+
*/
|
|
12717
|
+
function setDrain(fn) {
|
|
12718
|
+
this._drain = typeof fn === "function" ? fn : null;
|
|
12719
|
+
}
|
|
12720
|
+
|
|
12721
|
+
/**
|
|
12722
|
+
* Returns a Promise that resolves when the drain condition is met (or
|
|
12723
|
+
* immediately if no drain is set). Call this before emitting values to
|
|
12724
|
+
* apply backpressure.
|
|
12725
|
+
*
|
|
12726
|
+
* @returns {Promise<void>}
|
|
12727
|
+
*/
|
|
12728
|
+
}, {
|
|
12729
|
+
key: "awaitDrain",
|
|
12730
|
+
value: function awaitDrain() {
|
|
12731
|
+
return this._drain() || Promise.resolve();
|
|
12732
|
+
}
|
|
12733
|
+
}, {
|
|
12699
12734
|
key: "init",
|
|
12700
12735
|
value: function init() {
|
|
12701
12736
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
@@ -13364,29 +13399,33 @@ var AsyncDicomReader = /*#__PURE__*/function () {
|
|
|
13364
13399
|
key: "_emitSplitValues",
|
|
13365
13400
|
value: (function () {
|
|
13366
13401
|
var _emitSplitValues2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(length) {
|
|
13402
|
+
var _listener$awaitDrain;
|
|
13367
13403
|
var stream, listener, maxFragmentSize, offset, chunkSize, buffer;
|
|
13368
13404
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
13369
13405
|
while (1) switch (_context7.prev = _context7.next) {
|
|
13370
13406
|
case 0:
|
|
13371
13407
|
stream = this.stream, listener = this.listener;
|
|
13408
|
+
_context7.next = 3;
|
|
13409
|
+
return (_listener$awaitDrain = listener.awaitDrain) === null || _listener$awaitDrain === void 0 ? void 0 : _listener$awaitDrain.call(listener);
|
|
13410
|
+
case 3:
|
|
13372
13411
|
maxFragmentSize = this.maxFragmentSize;
|
|
13373
13412
|
offset = 0;
|
|
13374
|
-
case
|
|
13413
|
+
case 5:
|
|
13375
13414
|
if (!(offset < length)) {
|
|
13376
|
-
_context7.next =
|
|
13415
|
+
_context7.next = 15;
|
|
13377
13416
|
break;
|
|
13378
13417
|
}
|
|
13379
13418
|
chunkSize = Math.min(maxFragmentSize, length - offset);
|
|
13380
|
-
_context7.next =
|
|
13419
|
+
_context7.next = 9;
|
|
13381
13420
|
return stream.ensureAvailable(chunkSize);
|
|
13382
|
-
case
|
|
13421
|
+
case 9:
|
|
13383
13422
|
buffer = stream.readArrayBuffer(chunkSize);
|
|
13384
13423
|
listener.value(buffer);
|
|
13385
13424
|
offset += chunkSize;
|
|
13386
13425
|
stream.consume();
|
|
13387
|
-
_context7.next =
|
|
13426
|
+
_context7.next = 5;
|
|
13388
13427
|
break;
|
|
13389
|
-
case
|
|
13428
|
+
case 15:
|
|
13390
13429
|
case "end":
|
|
13391
13430
|
return _context7.stop();
|
|
13392
13431
|
}
|