Read and extract files from remote ZIP archives over HTTP range requests
Project description
zipwire
Extract individual files from remote ZIP archives over HTTP - without downloading the whole thing.
A zip wire gets you straight to your destination. This library does the same: it uses HTTP range requests to fetch only the central directory and the specific entries you ask for, skipping everything else. A 10 KB file inside a 2 GB archive? zipwire downloads roughly 10 KB (plus a small overhead for the central directory), not 2 GB.
How it works
ZIP archives store a central directory at the end of the file that lists every
entry with its offset and size. zipwire fetches that directory first (a single
range request), then makes one additional range request per file you extract.
The server must support Range requests (Accept-Ranges: bytes), which most
CDNs, object stores, and static file servers do.
Key features
- Selective extraction - download only the files you need, not the entire archive.
- Streaming decompression -
read_intodecompresses in chunks, keeping memory usage low even for large entries. - Sync and async -
SyncRemoteZipfor synchronous code,AsyncRemoteZipwithawait/async withfor asyncio. - ZIP64 - supports archives and entries larger than 4 GiB.
- Pluggable backends - bring your own HTTP library (see below).
Installation and backends
The default installation includes the urllib3 backend. To use a different HTTP library, install the matching extra - for example httpx2 gives you both sync and async:
pip install zipwire[httpx2]
| Backend | Class | Mode | HTTP | Install extra |
|---|---|---|---|---|
| urllib3 | Urllib3Reader |
sync | 1.1 | (included) |
| httpx2 | Httpx2SyncReader |
sync | 1.1, 2 | httpx2 |
| httpx2 | Httpx2AsyncReader |
async | 1.1, 2 | httpx2 |
| requests | RequestsReader |
sync | 1.1 | requests |
| aiohttp | AiohttpReader |
async | 1.1 | aiohttp |
Every backend accepts an optional pre-configured client or session so you can share connection pools, authentication, and retry configuration.
Examples
Sync - list files and read one
from zipwire import SyncRemoteZip
from zipwire.backends import Urllib3Reader
reader = Urllib3Reader("https://archive.example/data.zip")
with SyncRemoteZip(reader) as rz:
for info in rz.infolist():
print(f"{info.filename} {info.file_size} bytes")
data = rz.read("path/to/file.txt")
Sync - stream a large file to disk
read_into decompresses in chunks so peak memory stays low:
from zipwire import SyncRemoteZip
from zipwire.backends import Urllib3Reader
reader = Urllib3Reader("https://archive.example/large.zip")
with SyncRemoteZip(reader) as rz:
with open("output.bin", "wb") as f:
rz.read_into("big-file.bin", f)
Async
import asyncio
from zipwire import AsyncRemoteZip
from zipwire.backends import AiohttpReader
async def main():
reader = AiohttpReader("https://archive.example/data.zip")
async with AsyncRemoteZip(reader) as rz:
data = await rz.read("path/to/file.txt")
print(data.decode())
asyncio.run(main())
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zipwire-0.1.0.tar.gz.
File metadata
- Download URL: zipwire-0.1.0.tar.gz
- Upload date:
- Size: 154.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
92fc01a1dd83c1b64a87b103b1a7df033f50c996123b99fc59ecab94503b9a8f
|
|
| MD5 |
5e5bafbccaac59d18343ab6e9931b34f
|
|
| BLAKE2b-256 |
9b6ad595060a86b53d1051998e60f33d1c4c3e68458d353311f1559e621513c0
|
Provenance
The following attestation bundles were made for zipwire-0.1.0.tar.gz:
Publisher:
release.yml on tiran/zipwire
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zipwire-0.1.0.tar.gz -
Subject digest:
92fc01a1dd83c1b64a87b103b1a7df033f50c996123b99fc59ecab94503b9a8f - Sigstore transparency entry: 2159919265
- Sigstore integration time:
-
Permalink:
tiran/zipwire@3ff32e36c814eb25a63cdaf5dcd593d028b6ca70 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tiran
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3ff32e36c814eb25a63cdaf5dcd593d028b6ca70 -
Trigger Event:
push
-
Statement type:
File details
Details for the file zipwire-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zipwire-0.1.0-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f69b34258eb515d072e1943f73dbe687af73ec6f7476e2adcc781bb0fd22c32e
|
|
| MD5 |
227acb1869dfa7a007c1ef6cf189d32c
|
|
| BLAKE2b-256 |
1b37a818e4e362d079c3aa6f9c81ee0327754f91b1bfda9a234fbe12e244e5b0
|
Provenance
The following attestation bundles were made for zipwire-0.1.0-py3-none-any.whl:
Publisher:
release.yml on tiran/zipwire
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zipwire-0.1.0-py3-none-any.whl -
Subject digest:
f69b34258eb515d072e1943f73dbe687af73ec6f7476e2adcc781bb0fd22c32e - Sigstore transparency entry: 2159919361
- Sigstore integration time:
-
Permalink:
tiran/zipwire@3ff32e36c814eb25a63cdaf5dcd593d028b6ca70 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/tiran
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3ff32e36c814eb25a63cdaf5dcd593d028b6ca70 -
Trigger Event:
push
-
Statement type: