Skip to main content

A modular Python package for efficient, secure, and readable file operations.

Project description

BetterFileHandling

A Modular Python Library for Efficient and Secure File Operations

BetterFileHandling is a developer-focused utility library that simplifies and streamlines common file operations in Python. Designed for clarity, reliability, and modularity, this package offers well-structured methods for reading, writing, encoding, and managing files with clean exception handling.


Features

  • Modular and extensible architecture
  • Read/write support for plain text and JSON
  • Line-by-line and range-based reading
  • Base64 and plain encoding/decoding
  • Detailed file metadata inspection
  • Safe file operations: copy, move, rename, delete
  • File listing with filtering
  • Consistent error handling

Module Overview

Module Description Key Functions
reading.py Flexible file reading methods read_text(), readline(), read_lines(), read_all_lines(), read_until()
writing.py Structured file writing methods write_text(), write_lines(), write_json()
security.py File encoding and decoding encode_file(), decode_file(), encode_file_base64(), decode_file_base64()
file_management.py File and directory operations get_file_info(), copy_file(), move_file(), rename_file(), list_files_in_directory()

Installation

BetterFileHandling is published on PyPI. Install it using pip:

pip install BetterFileHandling

To use specific modules:

from reading import read_text
from writing import write_json
from file_management import get_file_info
from security import encode_file_base64

Usage Examples

Read a specific line:

from reading import readline

line = readline('example.txt', 3)
print(line)

Write multiple lines to a file:

from writing import write_lines

write_lines('log.txt', ['Process started.', 'Success.'], clear=True)

Encode file contents to Base64:

from security import encode_file_base64

encoded = encode_file_base64('data.txt')

Move a file safely:

from file_management import move_file

move_file('data.csv', 'backup/data.csv')

Error Handling Philosophy

All functions are designed to provide:

  • Clear, consistent error messages
  • Meaningful exceptions
  • Safe defaults that prevent destructive actions

This ensures predictable behavior and safer integration into automation scripts or production systems.


Compatibility

  • Python 3.8 and above
  • Cross-platform support: Linux, Windows, macOS

License

This project is released under the MIT License. See the LICENSE file for details.


Author

Aksh
Front-End Engineer, UI/UX Designer, and Python Developer
Created and maintained by a passionate 9th-grade developer from Delhi.

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

betterfilehandling-1.0.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

betterfilehandling-1.0.2-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file betterfilehandling-1.0.2.tar.gz.

File metadata

  • Download URL: betterfilehandling-1.0.2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for betterfilehandling-1.0.2.tar.gz
Algorithm Hash digest
SHA256 5af9122ce5840c1f053f8a0134eda072e51135785ab2ef5c8d4bf04764a3aa08
MD5 c990b48f6b8eefd64b9ddee9f415e6a6
BLAKE2b-256 36a1a799c188b0ea8bda4bc46313905b4c19d28441596556af5e6424f0da9d1e

See more details on using hashes here.

File details

Details for the file betterfilehandling-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for betterfilehandling-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 be9c7b6ed8d503773d396fede0fa3ddf24bc5d43f6d0dffc2c69ce524660bcdb
MD5 ff03c64db9e03a52cf6b879b552b3e84
BLAKE2b-256 54c44256fff57184db3817ae66c234429dc66529ce539930a8815bf7ca43132f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page