Enhanced archive filesystems for Pyfilesystem2
Project description
Requirements
pyfilesystem2 |
|||
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fs.archive-0.6.0.tar.gz
.
File metadata
- Download URL: fs.archive-0.6.0.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e7f27e35edced4ffa3c627c9efb33c3077950db3ffd1465ecfbd3b0216b2404f
|
|
MD5 |
225546e3fa66a97d7858e69ed29523eb
|
|
BLAKE2b-256 |
431fb692c3218eb1bb3fd5e3453d242e8f23b65950faccfc39376ab1ba5d09b2
|
File details
Details for the file fs.archive-0.6.0-py2.py3-none-any.whl
.
File metadata
- Download URL: fs.archive-0.6.0-py2.py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
7580c7f939f577164b368f46f257f3556e8ee1f76558cb082b5d554de13b1791
|
|
MD5 |
3b09a3bdb0576d5e36099e01a57eb6fa
|
|
BLAKE2b-256 |
6aa05550344f34b2894ed99c6d094131d3ad460370f2c853cf8a7eafdb06a21e
|