Skip to main content
Help improve PyPI by participating in a 5-minute user interface survey!

Enhanced archive filesystems for Pyfilesystem2

Project Description

Source PyPI Travis Codecov Codacy Format License

Requirements

pyfilesystem2 PyPI fs Source fs License fs
six PyPI six Source six License six

Installation

Install directly from PyPI, using pip

pip install fs.archive

Additional features

fs.archive also provides the following extras:

all
install all the extras listed below.
tar.xz
support for xz compressed tar files. Requires the additional backports.lzma module in Python 2, but is available natively in Python 3.
iso
pure-python reading/writing ISO disk images (with support for ISO 9660 Levels 1, 2 and 3, Joliet and Rock Ridge extensions). Requires the pycdlib library.

Usage

The fs.archive.open_archive function is the easiest way to open an archive filesystem, with an archive located on any other filesystem, directly determining the class to use from the file extension:

>>> from fs import open_fs
>>> from fs.archive import open_archive

>>> my_fs = open_fs(u'temp://')
>>> with open_archive(my_fs, u'test.zip') as archive:
...     type(archive)
<class 'fs.archive.zipfs.ZipFS'>

All the filesystems implemented in fs.archive also support reading from — and if not read-only, writing to — a file handle:

>>> import fs.archive.tarfs
>>> with fs.open_fs(u'mem://') as mem:
...     with fs.archive.tarfs.TarFS(mem.openbin(u'test.tar', 'w')) as tar:
...         tar.setbytes(u'hello', b'Hello, World!')
...     with fs.archive.tarfs.TarFS(mem.openbin(u'test.tar', 'r+')) as tar:
...         tar.isfile(u'hello')
True

See also

  • fs, the core pyfilesystem2 library
  • fs.sshfs, a SFTP/SSH implementation for pyfilesystem2 using paramiko
  • fs.smbfs, a SMB implementation for pyfilesystem2 using pysmb

Release history Release notifications

This version
History Node

0.3.2

History Node

0.3.1

History Node

0.3.0

History Node

0.2.0

History Node

0.1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
fs.archive-0.3.2-py2.py3-none-any.whl (25.3 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Apr 16, 2018
fs.archive-0.3.2.tar.gz (21.5 kB) Copy SHA256 hash SHA256 Source None Apr 16, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page