# zipmanager
[![downloads](https://static.pepy.tech/badge/zipmanager)](https://www.pepy.tech/projects/zipmanager) [![changelog](https://raw.githubusercontent.com/SimplePythonCoder/zipmanager/main/images/Changelog.svg)](https://github.com/SimplePythonCoder/zipmanager/blob/main/CHANGELOG.md) [![wiki](https://raw.githubusercontent.com/SimplePythonCoder/zipmanager/main/images/Wiki.svg)](https://github.com/SimplePythonCoder/zipmanager/wiki)
```
pip install zipmanager
```
## What does this package do ?
It allows you to create and handle zip folders as data without needing to save them.
## Usage
```python
from zipmanager import ZipFolder
file_data = b'some data'
zip_folder = ZipFolder({'file_name.file_extension': file_data})
# file extension not required
# ZipFolder will hold all the files given in the dictionary
file_data = zip_folder['file_name.file_extension']
# will return the file data
```
## Main functions
```python
from zipmanager import ZipFolder
file_data = b'some_data'
zip_folder = ZipFolder({'file_name.file_extension': file_data})
# list of functions:
zip_folder.add_files({'new_file': 'new_data'}) # add files to zip. read more at docstring.
zip_folder.delete_file('new_file') # removes file from zip
zip_folder.get('file_name') # returns None if file was not found
# or
zip_folder['file_name']
zip_folder.save() # saves zip in given location (empty is './temp.zip')
```
## File extension features
json and text files data is automatically returned as a dict or str respectively:
```python
from zipmanager import ZipFolder
file_data = b'{"key": "value"}'
zip_folder = ZipFolder({'file_name.json': file_data})
# .json extension is required to return a dict/list/str
data = zip_folder['file_name.json'] # returns a dict/list/str type
# same for .txt
file_data = b'text file data'
zip_folder = ZipFolder({'file_name.txt': file_data})
data = zip_folder['file_name.txt'] # returns a string
```
new in version 0.2.0 - files with the zip extension will return a ZipFolder object:
```python
from zipmanager import ZipFolder
zip_data = b'some zip data'
zip_folder = ZipFolder({'file_name.zip': zip_data})
data = zip_folder['file_name.zip'] # returns a ZipFolder object
```
Raw data
{
"_id": null,
"home_page": "https://github.com/SimplePythonCoder/zipmanager",
"name": "zipmanager",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "zip, zipfile",
"author": "SimplePythonCoder",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/1a/99/b568612c2f629574eed3185708ea7d3a3d4c57d3edcdb32738824d0a80b2/zipmanager-0.5.0.tar.gz",
"platform": null,
"description": "# zipmanager\r\n[![downloads](https://static.pepy.tech/badge/zipmanager)](https://www.pepy.tech/projects/zipmanager) [![changelog](https://raw.githubusercontent.com/SimplePythonCoder/zipmanager/main/images/Changelog.svg)](https://github.com/SimplePythonCoder/zipmanager/blob/main/CHANGELOG.md) [![wiki](https://raw.githubusercontent.com/SimplePythonCoder/zipmanager/main/images/Wiki.svg)](https://github.com/SimplePythonCoder/zipmanager/wiki)\r\n```\r\npip install zipmanager\r\n```\r\n## What does this package do ?\r\nIt allows you to create and handle zip folders as data without needing to save them.\r\n\r\n## Usage\r\n```python\r\nfrom zipmanager import ZipFolder\r\n\r\nfile_data = b'some data'\r\n\r\nzip_folder = ZipFolder({'file_name.file_extension': file_data})\r\n# file extension not required\r\n# ZipFolder will hold all the files given in the dictionary\r\n\r\nfile_data = zip_folder['file_name.file_extension']\r\n# will return the file data\r\n```\r\n\r\n## Main functions\r\n```python\r\nfrom zipmanager import ZipFolder\r\n\r\nfile_data = b'some_data'\r\nzip_folder = ZipFolder({'file_name.file_extension': file_data})\r\n\r\n# list of functions:\r\nzip_folder.add_files({'new_file': 'new_data'}) # add files to zip. read more at docstring.\r\nzip_folder.delete_file('new_file') # removes file from zip\r\n\r\nzip_folder.get('file_name') # returns None if file was not found\r\n# or\r\nzip_folder['file_name']\r\n\r\nzip_folder.save() # saves zip in given location (empty is './temp.zip')\r\n```\r\n\r\n## File extension features\r\njson and text files data is automatically returned as a dict or str respectively:\r\n```python\r\nfrom zipmanager import ZipFolder\r\n\r\nfile_data = b'{\"key\": \"value\"}'\r\n\r\nzip_folder = ZipFolder({'file_name.json': file_data})\r\n# .json extension is required to return a dict/list/str\r\n\r\ndata = zip_folder['file_name.json'] # returns a dict/list/str type\r\n\r\n# same for .txt\r\nfile_data = b'text file data'\r\nzip_folder = ZipFolder({'file_name.txt': file_data})\r\ndata = zip_folder['file_name.txt'] # returns a string\r\n```\r\nnew in version 0.2.0 - files with the zip extension will return a ZipFolder object:\r\n```python\r\nfrom zipmanager import ZipFolder\r\n\r\nzip_data = b'some zip data'\r\nzip_folder = ZipFolder({'file_name.zip': zip_data})\r\ndata = zip_folder['file_name.zip'] # returns a ZipFolder object\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Allows you to manage zip folders as data",
"version": "0.5.0",
"project_urls": {
"Homepage": "https://github.com/SimplePythonCoder/zipmanager",
"Issues": "https://github.com/SimplePythonCoder/zipmanager/issues",
"Source": "https://github.com/SimplePythonCoder/zipmanager"
},
"split_keywords": [
"zip",
" zipfile"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f0dac6030489ace7b63b44da0a1938e9d3089dc30a99768e4dd68cd1c3c71f22",
"md5": "2d63623b6335aeb503deeac281768f40",
"sha256": "1b0b73ae96b5ace43ed8a5d277c7da8b6a4e8a6c2bd622bcabd80810094c6fc1"
},
"downloads": -1,
"filename": "zipmanager-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2d63623b6335aeb503deeac281768f40",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 9120,
"upload_time": "2024-11-15T13:20:40",
"upload_time_iso_8601": "2024-11-15T13:20:40.419619Z",
"url": "https://files.pythonhosted.org/packages/f0/da/c6030489ace7b63b44da0a1938e9d3089dc30a99768e4dd68cd1c3c71f22/zipmanager-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1a99b568612c2f629574eed3185708ea7d3a3d4c57d3edcdb32738824d0a80b2",
"md5": "a4e0fbd140c07bacb2b783fbfd609df0",
"sha256": "66d2245756cb989dc6d338127c1201c5cde4be8a478357260d7789695c9e14e6"
},
"downloads": -1,
"filename": "zipmanager-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "a4e0fbd140c07bacb2b783fbfd609df0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 9424,
"upload_time": "2024-11-15T13:20:41",
"upload_time_iso_8601": "2024-11-15T13:20:41.481066Z",
"url": "https://files.pythonhosted.org/packages/1a/99/b568612c2f629574eed3185708ea7d3a3d4c57d3edcdb32738824d0a80b2/zipmanager-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-15 13:20:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SimplePythonCoder",
"github_project": "zipmanager",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "zipmanager"
}