Convenience decorators for reading and writing to compressed archives
Project description
Here are some decorators for reading and writing to compressed archives.
Installation
easy_install -U archiveIO
Usage
import archiveIO from cStringIO import StringIO @archiveIO.save def save(targetPath): open(targetPath, 'wt').write('xxx') @archiveIO.load def load(sourcePath): return open(sourcePath, 'rt').read() save('sample.txt') save('sample.txt.zip') save('sample.txt.tar.gz') save('sample.txt.tar.bz2') save('sample.txt.tar') assert 'xxx' == load('sample.txt') assert 'xxx' == load('sample.txt.zip') assert 'xxx' == load('sample.txt.tar.gz') assert 'xxx' == load('sample.txt.tar.bz2') assert 'xxx' == load('sample.txt.tar') archive = archiveIO.Archive(StringIO(), '.tar.gz') archive.save([ 'sample.txt', 'sample.txt.zip', ]) with archiveIO.TemporaryFolder() as temporaryFolder: for filePath in archive.load(temporaryFolder): print filePath
0.4
Added support for file-like objects when saving or loading archives
Added support for folderPaths when saving archives
Increased test coverage to 100%
0.3
Added Archive class
0.2
Ported code from zip_store
Added support for .tar.gz .tar.bz2 .tar
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
archiveIO-0.4.tar.gz
(4.7 kB
view hashes)