filepack


Namefilepack JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA user-friendly interface for handling files, archives, and compressed files in Python
upload_time2024-10-22 15:35:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.12.0
licenseMIT License Copyright (c) 2023 Dan Manor Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords file pack unpack archive compression compressor
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # filepack

A user-friendly interface for handling files, archives, and compressed files in Python.

## Features

- User-friendly interface for common file operations.
- Support for various archive types: TAR, ZIP, RAR, SEVEN_ZIP.
- Support for various compression types: GZIP, BZ2, LZ4, XZ.

## Installation
```
pip install filepack
```

## API Overview


### FilePack

| Method/Property       | Description                                     |
|-----------------------|-------------------------------------------------|
| `path`                | Returns the path of the file.                   |
| `suffix`              | Returns the file's suffix.                      |
| `is_compressed`       | Check if the file is compressed.                |
| `uncompressed_size`   | Get uncompressed size.                          |
| `compressed_size`     | Get compressed size.                            |
| `compression_ratio`   | Get compression ratio.                          |
| `compress`            | Compress the file.                              |
| `decompress`          | Decompress the file.                            |

### Archive

| Method/Property       | Description                                     |
|-----------------------|-------------------------------------------------|
| `path`                | Returns the path of the archive.                |
| `suffix`              | Returns the archive's suffix.                   |
| `extract_member`      | Extract a specific member.                      |
| `get_member`          | Get member's metadata                           |
| `get_members`         | Get a list of members metadata.                 |
| `add_member`          | Add a member to the archive.                    |
| `remove_member`       | Remove a member from the archive.               |
| `extract_all`         | Extract all members.                            |
| `remove_all`          | Remove all members from the archive.            |
| `print_members`       | Print all members.                              |

### Compression

| Method/Property       | Description                                     |
|-----------------------|-------------------------------------------------|
| `path`                | Returns the path of the compressed file.        |
| `suffix`              | Returns the file's suffix.                      |
| `uncompressed_size`   | Get uncompressed size.                          |
| `compressed_size`     | Get compressed size.                            |
| `compression_ratio`   | Get compression ratio.                          |
| `compress`            | Compress the file.                              |
| `decompress`          | Decompress the file.                            |
| `is_compressed`       | Check if the file is compressed.                |

## Usage

### Working with Archives

```
from filepack import FilePack


# if the given path can exist or not yet, but must refer to an archive.
file_pack = FilePack("path/to/your/archive/file")

# Extract a specific member
archive.extract_member(target_path="path/to/target/directory")

# Get a list of members
members = archive.get_members()

# Add a member to the archive
archive.add_member("path/to/member")

# Remove a member from the archive
archive.remove_member("name_of_member")

# Extract all members
archive.extract_all(target_path="path/to/target")

# Remove all members from the archive
archive.remove_all()

# Print all members
archive.print_members()
```
### Working with Compressions
```
from filepack import FilePack


# if the given path must exist, but can refer to a file which is compressed already or not.
file_pack = FilePack("path/to/your/existed/file")

# Compressed or not
is_compressed = file_pack.is_compressed(compression_algorithm="gz")

# Get uncompressed size
size = file_pack.uncompressed_size(compression_algorithm="gz")

# Compress and decompress files in place
new_path = file_pack.compress(compression_algorithm="gz") # with .gz
new_path = file_pack.decompress(compression_algorithm="gz") # without .gz

# Compress and decompress files into a different path
new_path = file_pack.compress(target_path="path/to/compressed/file", compression_algorithm="gz")
new_path = file_pack.decompress(target_path="path/to/uncompressed/file", compression_algorithm="gz")
```
### Working with Both
```
from filepack import FilePack


file_pack = FilePack("path/to/your/archive/file")

archive.add_member("path/to/member")
new_path = file_pack.compress(compression_algorithm="gz")
```

## Error Handling

`filepack` has built-in error handling mechanisms. It raises user-friendly exceptions for common errors, allowing you to handle them gracefully in your application.

## Contributing

Interested in contributing to `filepack`? [See our contribution guide](CONTRIBUTING.md).


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "filepack",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12.0",
    "maintainer_email": null,
    "keywords": "file, pack, unpack, archive, compression, compressor",
    "author": null,
    "author_email": "Dan Manor <danmanor11@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/2e/ef/f061e9345ca8c9c650c75530d1c750648464256b1fb50eb474d5aefc9e64/filepack-0.1.0.tar.gz",
    "platform": null,
    "description": "# filepack\n\nA user-friendly interface for handling files, archives, and compressed files in Python.\n\n## Features\n\n- User-friendly interface for common file operations.\n- Support for various archive types: TAR, ZIP, RAR, SEVEN_ZIP.\n- Support for various compression types: GZIP, BZ2, LZ4, XZ.\n\n## Installation\n```\npip install filepack\n```\n\n## API Overview\n\n\n### FilePack\n\n| Method/Property       | Description                                     |\n|-----------------------|-------------------------------------------------|\n| `path`                | Returns the path of the file.                   |\n| `suffix`              | Returns the file's suffix.                      |\n| `is_compressed`       | Check if the file is compressed.                |\n| `uncompressed_size`   | Get uncompressed size.                          |\n| `compressed_size`     | Get compressed size.                            |\n| `compression_ratio`   | Get compression ratio.                          |\n| `compress`            | Compress the file.                              |\n| `decompress`          | Decompress the file.                            |\n\n### Archive\n\n| Method/Property       | Description                                     |\n|-----------------------|-------------------------------------------------|\n| `path`                | Returns the path of the archive.                |\n| `suffix`              | Returns the archive's suffix.                   |\n| `extract_member`      | Extract a specific member.                      |\n| `get_member`          | Get member's metadata                           |\n| `get_members`         | Get a list of members metadata.                 |\n| `add_member`          | Add a member to the archive.                    |\n| `remove_member`       | Remove a member from the archive.               |\n| `extract_all`         | Extract all members.                            |\n| `remove_all`          | Remove all members from the archive.            |\n| `print_members`       | Print all members.                              |\n\n### Compression\n\n| Method/Property       | Description                                     |\n|-----------------------|-------------------------------------------------|\n| `path`                | Returns the path of the compressed file.        |\n| `suffix`              | Returns the file's suffix.                      |\n| `uncompressed_size`   | Get uncompressed size.                          |\n| `compressed_size`     | Get compressed size.                            |\n| `compression_ratio`   | Get compression ratio.                          |\n| `compress`            | Compress the file.                              |\n| `decompress`          | Decompress the file.                            |\n| `is_compressed`       | Check if the file is compressed.                |\n\n## Usage\n\n### Working with Archives\n\n```\nfrom filepack import FilePack\n\n\n# if the given path can exist or not yet, but must refer to an archive.\nfile_pack = FilePack(\"path/to/your/archive/file\")\n\n# Extract a specific member\narchive.extract_member(target_path=\"path/to/target/directory\")\n\n# Get a list of members\nmembers = archive.get_members()\n\n# Add a member to the archive\narchive.add_member(\"path/to/member\")\n\n# Remove a member from the archive\narchive.remove_member(\"name_of_member\")\n\n# Extract all members\narchive.extract_all(target_path=\"path/to/target\")\n\n# Remove all members from the archive\narchive.remove_all()\n\n# Print all members\narchive.print_members()\n```\n### Working with Compressions\n```\nfrom filepack import FilePack\n\n\n# if the given path must exist, but can refer to a file which is compressed already or not.\nfile_pack = FilePack(\"path/to/your/existed/file\")\n\n# Compressed or not\nis_compressed = file_pack.is_compressed(compression_algorithm=\"gz\")\n\n# Get uncompressed size\nsize = file_pack.uncompressed_size(compression_algorithm=\"gz\")\n\n# Compress and decompress files in place\nnew_path = file_pack.compress(compression_algorithm=\"gz\") # with .gz\nnew_path = file_pack.decompress(compression_algorithm=\"gz\") # without .gz\n\n# Compress and decompress files into a different path\nnew_path = file_pack.compress(target_path=\"path/to/compressed/file\", compression_algorithm=\"gz\")\nnew_path = file_pack.decompress(target_path=\"path/to/uncompressed/file\", compression_algorithm=\"gz\")\n```\n### Working with Both\n```\nfrom filepack import FilePack\n\n\nfile_pack = FilePack(\"path/to/your/archive/file\")\n\narchive.add_member(\"path/to/member\")\nnew_path = file_pack.compress(compression_algorithm=\"gz\")\n```\n\n## Error Handling\n\n`filepack` has built-in error handling mechanisms. It raises user-friendly exceptions for common errors, allowing you to handle them gracefully in your application.\n\n## Contributing\n\nInterested in contributing to `filepack`? [See our contribution guide](CONTRIBUTING.md).\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Dan Manor  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A user-friendly interface for handling files, archives, and compressed files in Python",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/danmanor/filepack/issues",
        "Repository": "https://github.com/danmanor/filepack"
    },
    "split_keywords": [
        "file",
        " pack",
        " unpack",
        " archive",
        " compression",
        " compressor"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee8c07146f4b4f19a756ba52ccbb109e543908438a43e187aa2b712b9d5048e9",
                "md5": "8c735c13c93fe3570191cfde17821b88",
                "sha256": "3238971612068cdd8ff621b859a01b5ec54e3568e5c8d3440b0cd9a653a4b2bd"
            },
            "downloads": -1,
            "filename": "filepack-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8c735c13c93fe3570191cfde17821b88",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12.0",
            "size": 24960,
            "upload_time": "2024-10-22T15:35:20",
            "upload_time_iso_8601": "2024-10-22T15:35:20.722412Z",
            "url": "https://files.pythonhosted.org/packages/ee/8c/07146f4b4f19a756ba52ccbb109e543908438a43e187aa2b712b9d5048e9/filepack-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2eeff061e9345ca8c9c650c75530d1c750648464256b1fb50eb474d5aefc9e64",
                "md5": "5ba28cc833b3a787c25288c34661ac5d",
                "sha256": "068a420a7fc9d4a96033fe6cc0a790640c8b1cfb6a8f34c24791c368e55bc450"
            },
            "downloads": -1,
            "filename": "filepack-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "5ba28cc833b3a787c25288c34661ac5d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12.0",
            "size": 18828,
            "upload_time": "2024-10-22T15:35:22",
            "upload_time_iso_8601": "2024-10-22T15:35:22.878272Z",
            "url": "https://files.pythonhosted.org/packages/2e/ef/f061e9345ca8c9c650c75530d1c750648464256b1fb50eb474d5aefc9e64/filepack-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-22 15:35:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "danmanor",
    "github_project": "filepack",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "filepack"
}
        
Elapsed time: 0.54736s