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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file ak_file-0.1.4.tar.gz.

File metadata

  • Download URL: ak_file-0.1.4.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for ak_file-0.1.4.tar.gz
Algorithm Hash digest
SHA256 86cb6630b7e3104c011aab46cd788fae5844e887db21097c4984772fd22e41bf
MD5 eb81ccc8f271572ad132da2f609d1c8a
BLAKE2b-256 f8c014d0fd0df9a531c24c9d00ce639147b16035b4c057d735da865cb9fda74d

See more details on using hashes here.

File details

Details for the file ak_file-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: ak_file-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for ak_file-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0187e715ccda787d0cf1afa10d30080c046b07ac9c60bcc702b99c3a2227ac79
MD5 295fd3f8b977a58bdf5c97b2fcca7825
BLAKE2b-256 f9a74c8e7b231b2cd1488eef73e2d473e7c1210b44f7e3c1f838d2c29c85f7d1

See more details on using hashes here.

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