swh.core.tarball module


Register new archive formats to uncompress

swh.core.tarball.uncompress(tarpath: str, dest: str)[source]

Uncompress tarpath to dest folder if tarball is supported.

Note that this fixes permissions after successfully uncompressing the archive.

  • tarpath – path to tarball to uncompress

  • dest – the destination folder where to uncompress the tarball


The nature of the tarball, zip or tar.


ValueError when a problem occurs during unpacking

swh.core.tarball.compress(tarpath, nature, dirpath_or_files)[source]

Create a tarball tarpath with nature nature. The content of the tarball is either dirpath’s content (if representing a directory path) or dirpath’s iterable contents.

Compress the directory dirpath’s content to a tarball. The tarball being dumped at tarpath. The nature of the tarball is determined by the nature argument.