Skip to main content

ak-file

A base module to manipulate files and folders

View Demo · Documentation · Report Bug · Request Feature


tests GitHub commit activity GitHub last commit

Table of Contents

1. About the Project

A base project to simplify file manipulation

1.1. Features

  • Can sanitize filename based on windows limitaions
  • Can search for and return files with specified filenames

2. Getting Started

2.1. Dependencies

The repo comes pre-compiled with all dependencies. Needs Python 3.11+

2.2. Installation

Install from pypi

pip install ak_file

3. Usage

import ak_file import File
file = File("<path/to/file>")

file.exists() # Returns bool
file.properties() # Returns dict

file.encrypt(password = 'Some Fancy Password') # Returns bytes data
file._DEFAULT_SALT = b'SuperSecureSaltForEncryption' # Change default encryption salt
file.decrypt(password = 'Some Fancy Password') # Returns bytes data

# To sanitize filename
from ak_file import sanitizer
sanitizer.sanitize("Dirty_windows_file_name.ext", strict=False)

# Obfuscate/Unobfuscate filename with simple char shift
sanitizer.obfuscate('Filename to obfuscate') # Returns 'WzCvErDvqKFqFswLJtrKv'
sanitizer.unobfuscate('WzCvErDvqKFqFswLJtrKv') # Returns 'Filename to obfuscate'

# Search
from ak_file import SearchFolder
search = SearchFolder(folder_path="Folder\path", recurse=True)

search.extension(extension_str='py') # by extension
search.size(min_size=1024, max_size=2048) # Bytes; by size
search.regex(pattern=r'[A-Z]{3}\.py', case_sensitive=False) # By regex
search.modification_date(start_date=datetime(2023,01,01), end_date=datetime(2023,10,10))

## search by generic function
search.search(condition=lambda file: 'Alpha' in file.parent)

4. Roadmap

  • Exception Handling
  • File Operations
    • Adding methods to write content to files.
    • Methods for appending content to files.
    • Support for working with directories: create, remove, list contents, move, etc.
  • Checksum Algorithms
  • Metadata Extraction
  • Support for More Encryption Options
  • Context Managers
  • File Comparison Methods
  • Logging and Debugging
  • Asynchronous I/O Support
  • Serialization and Deserialization
  • Support Different File Types

4. License

See LICENSE for more information.

5. Contact

Arun Kishore - @rpakishore

Project Link: https://github.com/rpakishore/ak-file

6. Acknowledgements

Metadata

Release files for ak_file 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ak_file 0.1.4
File Size Uploaded
ak_file-0.1.4.tar.gz 9.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ak_file 0.1.4
File Interpreter ABI Platform
ak_file-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / ak_file-0.1.4.tar.gz

Download URL ak_file-0.1.4.tar.gz
Size 9.8 kB
Tags Source
SHA-256 checksum
How to use checksums
86cb6630b7e3104c011aab46cd788fae5844e887db21097c4984772fd22e41bf
BLAKE2b-256 checksum
How to use checksums
f8c014d0fd0df9a531c24c9d00ce639147b16035b4c057d735da865cb9fda74d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / ak_file-0.1.4-py3-none-any.whl

Download URL ak_file-0.1.4-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0187e715ccda787d0cf1afa10d30080c046b07ac9c60bcc702b99c3a2227ac79
BLAKE2b-256 checksum
How to use checksums
f9a74c8e7b231b2cd1488eef73e2d473e7c1210b44f7e3c1f838d2c29c85f7d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page