Skip to content

Commit 83e9662

Browse files
MagicalTuxclaude
andcommitted
Add support for multiple readers per file
Enables efficient random access patterns like reading ZIP files where reads happen both at the end (central directory) and at various file locations throughout the archive. Changes: - Add httpReader struct to track individual HTTP connections - Support up to MaxReadersPerFile (default 3) concurrent readers per file - Select best reader based on position (closest that can reach target) - LRU eviction when reader limit is reached - Automatically close readers that would be "passed" by another read to avoid wasting connections - Update idle downloader to work with multi-reader system 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4a54e79 commit 83e9662

3 files changed

Lines changed: 234 additions & 84 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ if err != nil {
163163
| Option | Type | Default | Description |
164164
|--------|------|---------|-------------|
165165
| `MaxConcurrent` | `int` | 10 | Maximum number of concurrent HTTP connections |
166+
| `MaxReadersPerFile` | `int` | 3 | Maximum HTTP connections per file for random access patterns (e.g., ZIP files) |
166167
| `MaxDataJump` | `int64` | 512KB | Maximum bytes to read and discard when seeking forward (vs opening a new connection) |
167168
| `TmpDir` | `string` | `os.TempDir()` | Directory for temporary download files |
168169
| `Client` | `*http.Client` | `http.DefaultClient` | HTTP client for making requests |

0 commit comments

Comments
 (0)