PyFilesystem2 | |||
---|---|---|---|
six |
fs.archive
supports all Python versions supported by PyFilesystem2:
Python 2.7, and Python 3.5 onwards. Code should still be compatible with
Python 3.4, but is not tested anymore.
Install directly from PyPI, using pip:
$ pip install fs.archive
fs.archive
also provides the following
extras, allowing you to read from more archive formats:
- tar.xz: support for
xz
compressed tar files. Requires the additionalbackports.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. - 7z: support for 7z archives. Requires the
py7zr
andiocursor
libraries. - all: install all of the above.
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
Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker of the project if you need to report or ask something. If you are filling in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproductible situation.
fs.sshfs
is developed and maintained by:
The following people contributed to fs.archive
:
This project obviously owes a lot to the PyFilesystem2 project and all its contributors.