@zip.js/zip.js 2.7.67 → 2.7.68

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/lib/core/io.js CHANGED
@@ -378,11 +378,18 @@ async function readUint8ArrayHttpReader(httpReader, index, length, sendRequest,
378
378
  if (eocdCache && index == size - END_OF_CENTRAL_DIR_LENGTH && length == END_OF_CENTRAL_DIR_LENGTH) {
379
379
  return eocdCache;
380
380
  }
381
- const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index, length));
382
- if (response.status != 206) {
383
- throw new Error(ERR_HTTP_RANGE);
381
+ if (index >= size) {
382
+ return new Uint8Array();
383
+ } else {
384
+ if (index + length > size) {
385
+ length = size - index;
386
+ }
387
+ const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index, length));
388
+ if (response.status != 206) {
389
+ throw new Error(ERR_HTTP_RANGE);
390
+ }
391
+ return new Uint8Array(await response.arrayBuffer());
384
392
  }
385
- return new Uint8Array(await response.arrayBuffer());
386
393
  } else {
387
394
  const { data } = httpReader;
388
395
  if (!data) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A JavaScript library to zip and unzip files in the browser, Deno and Node.js",
4
4
  "author": "Gildas Lormeau",
5
5
  "license": "BSD-3-Clause",
6
- "version": "2.7.67",
6
+ "version": "2.7.68",
7
7
  "type": "module",
8
8
  "keywords": [
9
9
  "zip",