FileChunkCRUD


NameFileChunkCRUD JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/chigwell/FileChunkCRUD
SummaryPython package for CRUD operations on large files in chunks.
upload_time2024-01-07 17:13:04
maintainer
docs_urlNone
authorEugene Evstafev
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI version](https://badge.fury.io/py/FileChunkCRUD.svg)](https://badge.fury.io/py/FileChunkCRUD)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Downloads](https://static.pepy.tech/badge/filechunkcrud)](https://pepy.tech/project/filechunkcrud)

# FileChunkCRUD

`FileChunkCRUD` is a Python tool designed for Create, Read, Update, and Delete operations on files, especially large files that need to be processed in chunks to fit into memory constraints.

## Installation

To install `FileChunkCRUD`, you can use pip:

```bash
pip install FileChunkCRUD
```

## Usage

### As a Python Module

`FileChunkCRUD` can be used as a Python module in your scripts for handling large file operations.

#### Reading File in Chunks

```python
from filechunkcrud import FileHandler

file_path = '/path/to/your/largefile.txt'
file_handler = FileHandler(file_path)

for chunk in file_handler.read_chunks(chunk_size=1024):  # chunk_size in bytes
    print(chunk)  # or process the chunk
```

#### Creating a Large File with Generator

```python
def large_file_generator(size):
    for i in range(size):
        yield f"This is line {i} of the large file.\n"

file_handler.create_file(large_file_generator(1000000))  # For example, one million lines
```

#### Appending Data to an Existing File with Generator

```python
def additional_data_generator():
    yield "\nMore data...\n"

file_handler.update_file(additional_data_generator())
```

#### Deleting a File

```python
file_handler.delete_file()  # Deletes the file at file_path
```

## Features

- **Read**: Read large files in manageable chunks.
- **Create**: Create new files with content provided by a generator, ideal for large data sets.
- **Update**: Append to existing files using a generator for the content.
- **Delete**: Remove files from the filesystem.

## Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/yourusername/FileChunkCRUD/issues).

## License

This project is licensed under the [MIT License](https://choosealicense.com/licenses/mit/).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/chigwell/FileChunkCRUD",
    "name": "FileChunkCRUD",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Eugene Evstafev",
    "author_email": "chigwel@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fd/90/12264d2d3a5d8836e39df45f548a1d5b09ff7b25bf257aaca63e6231b477/FileChunkCRUD-0.0.5.tar.gz",
    "platform": null,
    "description": "[![PyPI version](https://badge.fury.io/py/FileChunkCRUD.svg)](https://badge.fury.io/py/FileChunkCRUD)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![Downloads](https://static.pepy.tech/badge/filechunkcrud)](https://pepy.tech/project/filechunkcrud)\n\n# FileChunkCRUD\n\n`FileChunkCRUD` is a Python tool designed for Create, Read, Update, and Delete operations on files, especially large files that need to be processed in chunks to fit into memory constraints.\n\n## Installation\n\nTo install `FileChunkCRUD`, you can use pip:\n\n```bash\npip install FileChunkCRUD\n```\n\n## Usage\n\n### As a Python Module\n\n`FileChunkCRUD` can be used as a Python module in your scripts for handling large file operations.\n\n#### Reading File in Chunks\n\n```python\nfrom filechunkcrud import FileHandler\n\nfile_path = '/path/to/your/largefile.txt'\nfile_handler = FileHandler(file_path)\n\nfor chunk in file_handler.read_chunks(chunk_size=1024):  # chunk_size in bytes\n    print(chunk)  # or process the chunk\n```\n\n#### Creating a Large File with Generator\n\n```python\ndef large_file_generator(size):\n    for i in range(size):\n        yield f\"This is line {i} of the large file.\\n\"\n\nfile_handler.create_file(large_file_generator(1000000))  # For example, one million lines\n```\n\n#### Appending Data to an Existing File with Generator\n\n```python\ndef additional_data_generator():\n    yield \"\\nMore data...\\n\"\n\nfile_handler.update_file(additional_data_generator())\n```\n\n#### Deleting a File\n\n```python\nfile_handler.delete_file()  # Deletes the file at file_path\n```\n\n## Features\n\n- **Read**: Read large files in manageable chunks.\n- **Create**: Create new files with content provided by a generator, ideal for large data sets.\n- **Update**: Append to existing files using a generator for the content.\n- **Delete**: Remove files from the filesystem.\n\n## Contributing\n\nContributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/yourusername/FileChunkCRUD/issues).\n\n## License\n\nThis project is licensed under the [MIT License](https://choosealicense.com/licenses/mit/).\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python package for CRUD operations on large files in chunks.",
    "version": "0.0.5",
    "project_urls": {
        "Homepage": "https://github.com/chigwell/FileChunkCRUD"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d57e16b55096e320ae0411f8da435129e1241303869771ccfd72750481570b0c",
                "md5": "f2fa80f0b17cdbcc364043edffeb4ed2",
                "sha256": "e1b4c5a5af64ad3d68cfe94361b8a1cb97612c854333f0908d1e2412b5195973"
            },
            "downloads": -1,
            "filename": "FileChunkCRUD-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f2fa80f0b17cdbcc364043edffeb4ed2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4792,
            "upload_time": "2024-01-07T17:13:01",
            "upload_time_iso_8601": "2024-01-07T17:13:01.307412Z",
            "url": "https://files.pythonhosted.org/packages/d5/7e/16b55096e320ae0411f8da435129e1241303869771ccfd72750481570b0c/FileChunkCRUD-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fd9012264d2d3a5d8836e39df45f548a1d5b09ff7b25bf257aaca63e6231b477",
                "md5": "48d38e8d85b24956642ccf81cc5d0637",
                "sha256": "5d9d6012641e983cff073a9ffbe8fe53e33795c14ee83351546ce5b4c4ab9b55"
            },
            "downloads": -1,
            "filename": "FileChunkCRUD-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "48d38e8d85b24956642ccf81cc5d0637",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3355,
            "upload_time": "2024-01-07T17:13:04",
            "upload_time_iso_8601": "2024-01-07T17:13:04.219470Z",
            "url": "https://files.pythonhosted.org/packages/fd/90/12264d2d3a5d8836e39df45f548a1d5b09ff7b25bf257aaca63e6231b477/FileChunkCRUD-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-07 17:13:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "chigwell",
    "github_project": "FileChunkCRUD",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "filechunkcrud"
}
        
Elapsed time: 0.52298s