Enhanced archive filesystems for Pyfilesystem2
Project description
Requirements
pyfilesystem2 |
|||
six |
|||
fs.proxy |
Installation
Install directly from PyPI, using pip
pip install fs.archive
Usage
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'test.zip') 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')
True
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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fs.archive-0.1.0.tar.gz.
File metadata
- Download URL: fs.archive-0.1.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb39f3752d8a2d10eb0d2abe0a0c2ef67a3265772c7b61b7be763aa6131049b4
|
|
| MD5 |
34fa786d23899af3658dc38d057ea3a4
|
|
| BLAKE2b-256 |
87003b550595a7bcaf3bd743d0a1e32cfcc169a012b6c1d81a7744fe82164ecc
|
File details
Details for the file fs.archive-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: fs.archive-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95d1e7be9f5b873dd623592b6595ffdba87085623dc6e19f26789ecd8c265f2e
|
|
| MD5 |
3596396c9ecdac81286ecd71747a4f40
|
|
| BLAKE2b-256 |
aa6ef10036f0af6590988ada15b4f9e6dd0f75187293155dadf2601746ed356b
|