ak_file

File Parsing function


License
MIT
Install
pip install ak_file==0.1.4

Documentation

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
file = ak_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")

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

# To search for files with extension
from ak_file import search
search.by_extension(folder_path="Folder\path", extension="py", search_subdir=True)

4. License

See LICENSE for more information.

5. Contact

Arun Kishore - @rpakishore

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

6. Acknowledgements