Skip to content

Commit

Permalink
Fallback to 1 or 5 chunks as necessary if chunks are larger than the …
Browse files Browse the repository at this point in the history
…size
  • Loading branch information
miraclx committed Jul 4, 2020
1 parent 74b7c9d commit 8b598cd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The purpose of the hasher is to check the integrity of the merged chunks while w

### <a id='xgetoptions'></a> XGETOptions <sub>`extends`</sub> [AxiosOpts][]: [`Object`][object]

- `chunks`: &lt;[number][]&gt; Number of chunked-simultaneous downloads. **Default**: `5`
- `chunks`: &lt;[number][]&gt; Maximum number of non-overlapping chunk connections. **Default**: `5`
- `retries`: &lt;[number][]&gt; Number of retries for each chunk. **Default**: `5`
- `timeout`: &lt;[number][]&gt; Network response timeout (ms). **Default**: `20000`
- `start`: &lt;[number][]&gt; Position to start feeding the stream from. **Default**: `0`
Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ async function xHeadData(store, opts) {
});
store.start = !acceptsRanges ? 0 : typeof offset === 'number' ? offset : store.start;
if (!Number.isFinite(store.size)) store.size = store.totalSize - store.start;
if (store.size < store.chunks) store.chunks = store.size < 5 ? 1 : 5;
const spec = parseSplitSpec(store.size, store.chunks);
store.chunkStack = buildChunks(
store.url,
Expand Down

0 comments on commit 8b598cd

Please sign in to comment.