@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/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zip-js/zip-js",
3
- "version": "2.7.67",
3
+ "version": "2.7.68",
4
4
  "exports": {
5
5
  ".": "./index.js",
6
6
  "./data-uri": "./lib/zip-data-uri.js"
@@ -8752,11 +8752,18 @@
8752
8752
  if (eocdCache && index == size - END_OF_CENTRAL_DIR_LENGTH && length == END_OF_CENTRAL_DIR_LENGTH) {
8753
8753
  return eocdCache;
8754
8754
  }
8755
- const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index, length));
8756
- if (response.status != 206) {
8757
- throw new Error(ERR_HTTP_RANGE);
8755
+ if (index >= size) {
8756
+ return new Uint8Array();
8757
+ } else {
8758
+ if (index + length > size) {
8759
+ length = size - index;
8760
+ }
8761
+ const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index, length));
8762
+ if (response.status != 206) {
8763
+ throw new Error(ERR_HTTP_RANGE);
8764
+ }
8765
+ return new Uint8Array(await response.arrayBuffer());
8758
8766
  }
8759
- return new Uint8Array(await response.arrayBuffer());
8760
8767
  } else {
8761
8768
  const { data } = httpReader;
8762
8769
  if (!data) {