Metadata-Version: 2.4
Name: pyfile-adarsh
Version: 0.1.0
Summary: A simple and developer-friendly Python library for common file and directory operations.
Author: Adarsh Pandey
License: MIT License
        
        Copyright (c) 2026 Adarsh Pandey
        
        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,directory,filesystem,file-handling,utilities
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# pyfile

A simple and developer-friendly Python library for common file and directory operations.

## Installation

```bash
pip install pyfile
```

> **Note:** `pyfile` is currently under development. The package can be installed locally using `pip install -e .`.

## Quick Example

```python
from pyfile import File

file = File("example.txt")

file.write("Hello World!")

print(file.read())
print(file.size())
```

Output:

```text
Hello World!
12
```

## Directory Example

```python
from pyfile import Directory

directory = Directory("documents")

directory.create()

print(directory.exists())

for file in directory.files():
    print(file.path)
```

## Features

### File

- Check if a file exists
- Read file contents
- Write content to a file
- Append content to a file
- Get file size
- Rename files
- Copy files
- Move files
- Delete files
- Support for custom text encoding

### Directory

- Check if a directory exists
- Create directories
- List files
- List directories
- Check if a directory is empty
- Delete empty directories

## File Example

```python
from pyfile import File

file = File("example.txt")

# Write
file.write("Hello World!")

# Read
print(file.read())

# Append
file.append("\nWelcome to pyfile!")

# Size
print(file.size())

# Rename
file.rename("new_example.txt")
```

## Directory Example

```python
from pyfile import Directory

directory = Directory("documents")

# Create directory
directory.create()

# Check existence
print(directory.exists())

# List files
for file in directory.files():
    print(file.path)

# List folders
for folder in directory.folders():
    print(folder.path)

# Check if empty
print(directory.is_empty())
```

## Project Structure

```text
pyfile/
│
├── README.md
├── pyproject.toml
│
├── src/
│   └── pyfile/
│       ├── __init__.py
│       ├── file.py
│       ├── directory.py
│       └── exceptions.py
│
└── tests/
    ├── test_file.py
    └── test_directory.py
```

## Development

Install the package in editable mode:

```bash
pip install -e .
```

Install pytest:

```bash
pip install pytest
```

Run the test suite:

```bash
pytest
```

Run tests in verbose mode:

```bash
pytest -v
```

## Testing

The project uses `pytest` for automated testing.

The test suite covers:

- File creation and existence
- Reading files
- Writing files
- Appending content
- File size
- File renaming
- File copying
- File moving
- File deletion
- Missing file errors
- Unicode content
- Directory creation
- Directory existence
- Listing files
- Listing folders
- Empty directory detection
- Directory deletion

## Current Status

`pyfile` is currently in early development.

Current version:

```text
0.1.0
```

More features, improved error handling, documentation, and additional tests will be added as the project develops.

## License

MIT License
