Skip to main content

python script to extract files from remote ZIP archives without downloading the entire archive

Project description

cloud_unzip

python script to extract files from remote ZIP archives without downloading the entire archive

Installation

pip install cloud_unzip

Usage

usage: cloud_unzip [-h] [-l] [-t] [-e EXTRACT] [-f FIND] [-r] [-o OUTPUT] [-p] [-w WORKERS] [--flatten] [--password PASSWORD] url

Extract files from remote ZIP archives

positional arguments:
  url                   URL of the remote ZIP file

options:
  -h, --help            show this help message and exit
  -l, --list            List files in the ZIP archive
  -t, --tree            Display zip contents in tree format
  -e EXTRACT, --extract EXTRACT
                        Extract specific files from the ZIP archive (supports glob patterns)
  -f FIND, --find FIND  Find files matching patterns (supports glob patterns)
  -r, --regex           Use regex patterns instead of glob patterns
  -o OUTPUT, --output OUTPUT
                        Output directory for extracted files. Use "-" to write to stdout
  -p, --parallel        Extract files in parallel
  -w WORKERS, --workers WORKERS
                        Maximum number of worker threads for parallel extraction
  --flatten             Extract files without preserving directory structure
  --password PASSWORD   Password for encrypted ZIP files

To extract a single file

cloud_unzip -e path/to/file/inside/zip <url>

To extract Multiple files

  • Enter file paths comma separated
cloud_unzip -e path/to/file1,path/to/file2,path/to/file3 <url>

  • use --parallel to extract multiple files parallely , default extraction method is sequential

  • If the ZIP file is encrypted, it will ask for a password during extraction, or it can be provided using the --password <your password> argument.


Limitations

  • Server must support range request

Use as module

  • Example
from cloud_unzip import RemoteZipExtractor

url = "https://example.com/yourfile.zip"
extractor = RemoteZipExtractor(url)

# List files in the ZIP archive
files = extractor.list_files()
print("Files in zip:", files)

# Extract a specific file
extracted_path = extractor.extract_file("docs/readme.txt", output_path="readme.txt")
print(f"Extracted to: {extracted_path}")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cloud_unzip-0.1.4.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cloud_unzip-0.1.4-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file cloud_unzip-0.1.4.tar.gz.

File metadata

  • Download URL: cloud_unzip-0.1.4.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for cloud_unzip-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7d439374986e8bfd147c41f34c2de3517142fe9f0aac10edb38411132e73c83f
MD5 01991a373e5e5b2813d9b3a99bdbb864
BLAKE2b-256 51e11acc047dc90709e6d514d50729740ff70c94ab74b1c6f1418879f42303e5

See more details on using hashes here.

File details

Details for the file cloud_unzip-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: cloud_unzip-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for cloud_unzip-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c1862ae520591c44d606ea358157cfca0b3d2f72612fdbdc5edb097eab873702
MD5 3542c194cadaffaea67210cea0e15cf4
BLAKE2b-256 471ac7b6bef8846a947a382f58c77cad356f0029e10abaf28b43355e8fd4a889

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page