Skip to main content

Enhanced archive filesystems for Pyfilesystem2

Project description

Source PyPI Travis Codecov Codacy Format License


pyfilesystem2 PyPI fs Source fs License fs
six PyPI six Source six License six
fs.proxy PyPI fs.proxy Source fs.proxy License fs.proxy


Install directly from PyPI, using pip

pip install fs.archive


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

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

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

All the filesystems implemented in fs.archive also support reading and writing from and to a file handle 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')

fs.archive declares three abstract base classes in fs.archive.base:

  • ArchiveSaver: defines how an archive is saved (in essence, a class managing the compression of a filesystem)
  • ArchiveReadFS: a read-only filesystem that implements the methods required to read the archive
  • ArchiveFS: a proxy filesystem used to make an archive seemingly writable

See also

  • fs, the core pyfilesystem2 library
  • fs.proxy, miscellaneous proxy filesystems for pyfilesystem2
  • fs.sshfs, a SFTP/SSH implementation for pyfilesystem2 using paramiko

Project details

Download files

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

Files for fs.archive, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size fs.archive-0.1.0-py2.py3-none-any.whl (15.4 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size fs.archive-0.1.0.tar.gz (12.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page