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. get_all does not support a mode parameter, it always returns binary file data.

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.1.tar.gz (5.3 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.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nestedarchive-0.3.1.tar.gz
  • Upload date:
  • Size: 5.3 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.1.tar.gz
Algorithm Hash digest
SHA256 52ae12d234582ed718cf51f41daa2dbbda9d85203980efc7dd361de9f03e8be1
MD5 247594dd5bf9a31770ce962b5bf660d9
BLAKE2b-256 9c7234ce0d8c2ff1a13c0f7eb8a6405b2b38821ea70cb1bec5e413b208839c07

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nestedarchive-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad6416838ee81a4a16ab02acfa527ff21658e012dd10c0ec7c79d1eafb7d1218
MD5 c3cf5bdf23ce81cbffede32b94bb5fef
BLAKE2b-256 d7ce8b4937d41a64fd47a142ad774889dee01a15c41fad636517f9fd7c107a67

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