Python package for CRUD operations on large files in chunks.
Project description
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:
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
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
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
def additional_data_generator():
yield "\nMore data...\n"
file_handler.update_file(additional_data_generator())
Deleting a File
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.
License
This project is licensed under the MIT License.
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
Built Distribution
File details
Details for the file FileChunkCRUD-0.0.5.tar.gz
.
File metadata
- Download URL: FileChunkCRUD-0.0.5.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d9d6012641e983cff073a9ffbe8fe53e33795c14ee83351546ce5b4c4ab9b55 |
|
MD5 | 48d38e8d85b24956642ccf81cc5d0637 |
|
BLAKE2b-256 | fd9012264d2d3a5d8836e39df45f548a1d5b09ff7b25bf257aaca63e6231b477 |
File details
Details for the file FileChunkCRUD-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: FileChunkCRUD-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1b4c5a5af64ad3d68cfe94361b8a1cb97612c854333f0908d1e2412b5195973 |
|
MD5 | f2fa80f0b17cdbcc364043edffeb4ed2 |
|
BLAKE2b-256 | d57e16b55096e320ae0411f8da435129e1241303869771ccfd72750481570b0c |