Skip to main content

Simple file handling utilities for Python

Project description

fileutils-nandu

fileutils-nandu is a lightweight and practical Python utility package that provides commonly used file-handling operations through a clean and reusable API.
The package is designed to reduce repetitive boilerplate code for everyday file operations in scripts, automation tasks, and small projects.


Features

Basic File Operations

  • Read text files
  • Write text files
  • Append content to files
  • Check whether a file exists
  • Count the number of lines in a file

Advanced File Utilities

  • Copy files from one location to another
  • Delete files safely
  • Get file size in bytes or kilobytes
  • List files in a directory using wildcard patterns (for example, *.txt)

Installation

Install the package directly from PyPI:

pip install fileutils-nandu

Basic Usage

from fileutils import write_file, read_file, line_count

write_file("example.txt", "Hello\nWorld")
print(read_file("example.txt"))
print(line_count("example.txt"))

Output:

Hello
World
2

Advanced Usage

from fileutils import copy_file, delete_file, file_size, list_files

copy_file("example.txt", "example_copy.txt")

print(file_size("example.txt"))              # size in bytes
print(file_size("example.txt", unit="kb"))   # size in kilobytes

print(list_files(".", "*.txt"))

delete_file("example_copy.txt")

Available Functions

Function Description
read_file(path) Reads and returns the content of a file
read_lines(path) Returns file content as a list of lines
write_file(path, content) Writes content to a file
append_file(path, content) Appends content to an existing file
file_exists(path) Checks if a file exists
line_count(path) Returns the number of lines in a file
copy_file(src, dst) Copies a file from source to destination
delete_file(path) Deletes a file if it exists
file_size(path, unit) Returns file size in bytes or KB
list_files(directory, pattern) Lists files matching a pattern

Project Structure

fileutils/
├── reader.py     # File reading utilities
├── writer.py     # File writing utilities
├── utils.py      # Advanced file operations
└── __init__.py   # Public package interface

Why This Package

  • Avoids rewriting common file-handling logic
  • Clean and beginner-friendly API
  • Useful for automation, scripting, and small projects
  • Lightweight and dependency-free

License

MIT License


Author

Nandu

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

fileutils_nandu-0.2.0.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

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

fileutils_nandu-0.2.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file fileutils_nandu-0.2.0.tar.gz.

File metadata

  • Download URL: fileutils_nandu-0.2.0.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for fileutils_nandu-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0756a0f2a165395878c324e849c8a9e485371966dd8eb4978292775f5c05315d
MD5 f809fb7f0d0975a860473773359cd4bf
BLAKE2b-256 d4be5e596cce0e6c3f31781b0ce49f55f89b650369121c695afcca91a708980f

See more details on using hashes here.

File details

Details for the file fileutils_nandu-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for fileutils_nandu-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 046f4672d5b4f25b9fa9a1793f313f65a1fd7b202dffbe86b09a41caf650546b
MD5 11345213d0015bb68a0733ff937f9a53
BLAKE2b-256 54005b26dc4796baf62cef80795ea0965e60d3e442c1d1eca1c4c1fd82f5e17e

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