Skip to content
Wrapper around tarfile to add support for more compression formats
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
xtarfile
.gitignore
.travis.yml
LICENSE.txt
MANIFEST.in
README.rst
setup.py

README.rst

xtarfile

https://api.travis-ci.org/ascoderu/xtarfile.svg?branch=master

Overview

Wrapper around tarfile to add support for more compression formats.

Usage

First, install the library with the tarfile compression formats you wish to support. The example below shows an install for zstandard tarfile support.

pip install xtarfile[zstd]

You can now use the xtarfile module in the same way as the standard library tarfile module:

import xtarfile as tarfile

with tarfile.open('some-archive', 'w:zstd') as archive:
    archive.add('a-file.txt')

with tarfile.open('some-archive', 'r:zstd') as archive:
    archive.extractall()

Alternatively, detecting the correct compression module based on the file extensions is also supported:

import xtarfile as tarfile

with tarfile.open('some-archive.tar.zstd', 'w') as archive:
    archive.add('a-file.txt')

with tarfile.open('some-archive.tar.zstd', 'r') as archive:
    archive.extractall()

Development

Install the project's dependencies with pip install .[zstd].

Run the tests via python3 setup.py test.

You can’t perform that action at this time.