Skip to main content

Random Access Read-Only Tar Mount Library

Project description

Random Access Read-Only Tar Mount (Ratarmount) Library

This is the library used as backend by ratarmount (CLI). For a full description including motivation and performance comparisons, see ratarmount.

Table of Contents

  1. Installation
  2. Usage

Installation

PIP Package Installation

In many cases a simple pip install should work:

pip install ratarmountcore[full]

If there is trouble with one of the compression dependencies, first try installing it without dependencies:

pip install ratarmountcore

And if that works, only install those dependencies you need, e.g.:

pip install ratarmountcore[bzip2,gzip]

You can install the latest development version with:

python3 -m pip install --user --force-reinstall 'git+https://github.com/mxmlnkn/ratarmount.git@develop#egginfo=ratarmountcore&subdirectory=core'

Dependencies

Python 3.6+ and preferably pip 19.0+ are required. These should be preinstalled on most systems.

Ratarmountcore has as few required dependencies as necessary in order to cause the least troubles on all possible systems. This means that only uncompressed TAR and ZIP support will work by default. All optional dependencies are offered as extras.

Extras

Ratarmountcore offers these extras (optional dependencies):

  • full, bzip2, gzip, rar, xz, zip, zstd

Full includes all dependencies of the other extras. The zip extra is currently only a placeholder because the built-in zipfile module is being used.

In order to install one of these extract, append them in brackets:

python3 -m pip install --user ratarmount[bzip2]

If you are installing on a system for which there exists no manylinux wheel, then you'll have to install dependencies required to build from source:

sudo apt install python3 python3-pip fuse build-essential software-properties-common zlib1g-dev libzstd-dev liblzma-dev

Usage

This library offers an interface which is sufficient to work with FUSE. This MountSource interface has methods for listing paths and getting file metadata and contents.

The ratarmountcore library offers multiple implementations of MountSource for different archive formats:

  • SQLiteIndexedTar: This is the oldest and most powerful implementation. It supports fast access to files inside (compressed) TARs.
  • RarMountSource: An implementation for RARs using rarfile.
  • ZipMountSource: An implementation for ZIPs using zipfile.
  • FolderMountSource: An implementation taking an existing folder as input.

There also are these functional implementations of MountSource:

  • UnionMountSource: Takes multiple MountSource implementations and shows a merged view of their file hierarchy.
  • FileVersionLayer: Takes a MountSource as input, decodes the requested paths, also accepting <file>.version/<number> paths, and calls the methods of the MountSource with the given file version.
  • AutoMountLayer: Takes one MountSource, goes over all its files and mounts archives recursively in a similar manner to UnionMountSource.

The factory function open opens one of the archive MountSource implementations according to the file type.

Mount Source Class Diagram

Example

import ratarmountcore as rmc

archive = rmc.open("foo.tar", recursive=True)
archive.listDir("/")
info = archive.getFileInfo("/bar")

print "Contents of /bar:"
with archive.open(info) as file:
    print(file.read())

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

ratarmountcore-0.2.1.tar.gz (53.5 kB view details)

Uploaded Source

Built Distribution

ratarmountcore-0.2.1-py3-none-any.whl (60.3 kB view details)

Uploaded Python 3

File details

Details for the file ratarmountcore-0.2.1.tar.gz.

File metadata

  • Download URL: ratarmountcore-0.2.1.tar.gz
  • Upload date:
  • Size: 53.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for ratarmountcore-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d702f19e3963a259ac4124ef2c556a01d0a26a60f7f6973f5fa735444dfffe37
MD5 ae933d95dab17e68b207e260522edc04
BLAKE2b-256 550f01c61c4a46bd4c5dd9d5450b15833e516a36ee22acde31ad688f0dcc17a6

See more details on using hashes here.

File details

Details for the file ratarmountcore-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ratarmountcore-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 60.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

File hashes

Hashes for ratarmountcore-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9a60a2aa78ffd8bd559b1e2d6eaeb770eefc3b05118dfbbd68062bad7b8b85c
MD5 32e85dfb3708d333c786967da1f9908a
BLAKE2b-256 9806f48cc6172cc492812ae1faff00b4058b46a4bd19c4f9339173711f8cf1c3

See more details on using hashes here.

Supported by

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