@dcmjs-org/parser 1.0.0-beta.10 → 1.0.0-beta.11

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.mjs CHANGED
@@ -1820,14 +1820,9 @@ async function fromPart10StreamImpl(input, listener, options, parseState) {
1820
1820
  chunkSize: INFLATE_CHUNK_SIZE
1821
1821
  });
1822
1822
  inflater.onData = chunk => {
1823
- // chunk is a Uint8Array (pako 2.x). Slice to an owned
1824
- // ArrayBuffer so bodyStream's view doesn't alias pako's buffer.
1825
- bodyStream.addBuffer(
1826
- chunk.buffer.slice(
1827
- chunk.byteOffset,
1828
- chunk.byteOffset + chunk.byteLength
1829
- )
1830
- );
1823
+ // chunk is a Uint8Array (pako 2.x); addBuffer copies a view,
1824
+ // so bodyStream doesn't alias pako's buffer.
1825
+ bodyStream.addBuffer(chunk);
1831
1826
  };
1832
1827
 
1833
1828
  let relayPos = relayStartPos;
@@ -3117,16 +3112,12 @@ async function* readableStreamToAsyncIterable(stream) {
3117
3112
  * arrays, and plain ArrayBuffers.
3118
3113
  *
3119
3114
  * @param {Uint8Array|ArrayBuffer} chunk
3120
- * @returns {ArrayBuffer}
3115
+ * @returns {Uint8Array|ArrayBuffer} the chunk, after the type check
3121
3116
  */
3122
3117
  function toArrayBuffer(chunk) {
3123
- if (chunk instanceof ArrayBuffer) return chunk;
3124
- if (ArrayBuffer.isView(chunk)) {
3125
- // Typed array (Uint8Array, Buffer, etc.): slice to own ArrayBuffer.
3126
- return chunk.buffer.slice(
3127
- chunk.byteOffset,
3128
- chunk.byteOffset + chunk.byteLength
3129
- );
3118
+ // addBuffer copies a view (Uint8Array, Buffer, etc.) itself
3119
+ if (chunk instanceof ArrayBuffer || ArrayBuffer.isView(chunk)) {
3120
+ return chunk;
3130
3121
  }
3131
3122
  throw new TypeError(
3132
3123
  `fromPart10Stream: expected Uint8Array|ArrayBuffer chunk from iterable, ` +