Skip to main content

File Parsing function

Project description

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

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

ak_file-0.1.4.tar.gz (9.8 kB view hashes)

Uploaded Source

Built Distribution

ak_file-0.1.4-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

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