Skip to main content

Seamless reading of nested archives

Project description

PyPI

Allows simplified access to files in nested archives.

Example

Given an archive placed in /tmp/foobar/foo.tar with this structure:

foo.tar
    - foo1
    - foo2
    - bar.tar
       - bar1
       - bar2
       - foo3.tar.gz
            - foo4
            - foo5
       - foo6.tar.gz
            - foo7
            - foo8
    - abc/
       - def
       - ghi

This library will allow reading the contents of the files in this nested archive in the following "seamless" manner:

import nestedarchive

nestedarchive.get("/tmp/foobar/foo.tar/foo1")
nestedarchive.get("/tmp/foobar/foo.tar/abc/def")
nestedarchive.get("/tmp/foobar/foo.tar/bar.tar/bar1")
nestedarchive.get("/tmp/foobar/foo.tar/bar.tar/foo3.tar.gz/foo4")

Globs are also supported - all matches are tried until one is found that (eventually) contains the expected file, e.g.:

- nestedarchive.get("/tmp/foobar/foo.tar/bar.tar/foo*.tar.gz/foo7")

Will first silently try foo3.tar.gz and fail because it does not contain foo7, then it will try foo6.tar.gz and succeed because foo6.tar.gz contains foo7

If you want to get all files matching a glob, use get_all instead.

You can also access a URL instead of a local file path:

archive = nestedarchive.RemoteNestedArchive("https://example.com/archive.tar")
content = archive.get("/nested/path/file.txt")

Currently supported extensions:

  • tar
  • tar.gz

Currently tested operating systems:

  • linux

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

nestedarchive-0.3.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

nestedarchive-0.3.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file nestedarchive-0.3.0.tar.gz.

File metadata

  • Download URL: nestedarchive-0.3.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nestedarchive-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9d9fe98adbbdbdc7b6ca962d604db7592612882d484d45a1f0e6a4cb0bf9de4a
MD5 eb23b5681aaf949118eeb2a184bb6124
BLAKE2b-256 69d1c2612b382593c30c1dbc480d72335616cc1553a2459107ccc5c50f80e133

See more details on using hashes here.

File details

Details for the file nestedarchive-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: nestedarchive-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nestedarchive-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 40c5b760cebdba59147a35312d439624075fb50c3ea2eca2539dba0c89ae6678
MD5 48ec21fdc266f0ed12f519ac17d2103f
BLAKE2b-256 ecc1b743908de0a9e4361219420208a814fbf15f4900fa0ecab75ab36f2c5698

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