Skip to content

missinglinks/zip_archive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZipArchive

ZipArchive class for easy/quick data storage (text and json files).

Installation

  1. Clone repo
$ git clone https://github.com/missinglinks/zip_archive.git
  1. Install with pip
$ cd zip_archive
$ pip install .

Usage

from zip_archive import ZipArchive

z = ZipArchive("test.zip")

data = { 
    "key1": "foo",
    "key2": "bar"
}

if "data.json" not in z:
    z["data.json"] = data

assert data == z["data.json"]

Options

Upon initialization various parameters can be given to customize the behaviour of the ZipArchive class.

  • overwrite (default: False): If a zipfile with the given filename exists, it will be truncated (i.e. overwritten)
  • json_ext (default: ".json"): Files ending with json_ext will be piped through json.loads upon retrieval
  • json_indent (default: 4): The default indentation for json files is 4.

Limitations

  • You cannot remove/change file in the archive

License

MIT

Copyright

Peter Mühleder and Universitätsbibliothek Leipzig, 2019

About

ZipArchive python module for simple, quick data storage (text and json files)

Resources

License

Stars

3 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages