A lightweight and fast Python API for simplifying file operations
Project description
pyfastfile
A lightweight Python library for easy-to-use operations.
Installation
pip install pyfastfile
Usage
The encoding parameter defaults to utf-8 in all functions that support text encoding.
All index-based functions use zero-based indexing.
Titles
- Main Functions
- Csv Functions
- Json Functions
- Directory Functions
- Archive Functions
- Encryption Functions
- Utility Functions
Main Functions
| Function Name | Description | Arguments | Returns |
|---|---|---|---|
overwrite() |
Overwrites a file with given content. | path:str, data:str,encoding:str |
None |
append() |
Appends data to the end of a file. | path:str, data:str,encoding:str |
None |
read() |
Reads entire file content as string. | path:str,encoding:str |
str |
read_bytes() |
Reads entire file content as raw bytes. | path:str |
bytes |
readlines() |
Returns file lines as a list. | path:str, newline:bool,encoding:str |
list |
getline() |
Returns a specific line from file. | path:str, line:int,newline:bool,encoding:str |
str |
exists() |
Checks if file exists. | path:str |
bool |
find() |
Returns lines containing target text. | path:str,data:str,encoding:str |
list[str] |
find_num() |
Returns line numbers matching target text. | path:str,data:str,encoding:str |
list[int] |
delete() |
Deletes the target file. | path:str |
None |
rename() |
Rename target file. | path:str, name:str |
None |
touch() |
Creates a file. | path:str,existserror:bool |
None |
move() |
Moves a files | filepath:str,targetpath:str |
None |
clear() |
Clears the content of a file by overwriting it with an empty string. | path: str, encoding: str = "utf-8" |
None |
count_lines() |
Returns the number of lines in a file. | path: str |
int |
size_mb() |
Returns file size in megabytes. | path:str |
float |
size() |
Returns file size in bytes. | path:str |
int |
Csv Functions
| Function Name | Description | Arguments | Returns |
|---|---|---|---|
csv_read() |
Read target csv. | path:str,encoding:str |
Generator |
csv_append() |
Appends data to the end of a csv file. | path:str,data:list,encoding:str |
None |
csv_getheader() |
Return header of the target csv file. | path:str,encoding:str |
list |
csv_getrow() |
Return target row of the csv file. | path:str,row:int,encoding:str |
list |
csv_getcolumn() |
Return target column of the csv file. | path:str,column:str,encoding:str |
list |
csv_getdata() |
Gets a value from CSV by row and column. | path:str,row:int,column:str,encoding:str, |
any |
csv_updaterow() |
Update target row | path:str,row:int,new_data:list,encoding:str |
None |
csv_overwrite() |
Overwrite on target file. | path:str,data:list,encoding:str |
None |
csv_count() |
Return length of target file. | path:str,withheader:bool |
int |
Json Functions
| Function Name | Description | Arguments | Returns |
|---|---|---|---|
json_read() |
Read target JSON file and parse its content. | path:str |
dict |
json_overwrite() |
Overwrite target JSON file with new data. | path:str, data:dict, encoding:str |
None |
json_append() |
Reads JSON file, merges new dictionary into existing data (key update behavior). | path:str, data:dict |
None |
json_delete_key() |
Deletes a specific key from JSON data and rewrites the file. | path:str, key:str, encoding:str |
None |
json_is_valid() |
Checks whether the target JSON file contains valid JSON data. | path:str |
bool |
json_get_values() |
Returns all values from the target JSON object. | path:str, withlist:bool, encoding:str |
dict_values |
json_get_keys() |
Returns all keys from the target JSON object. | path:str, withlist:bool, encoding:str |
dict_keys |
Directory Functions
| Function Name | Description | Arguments | Returns |
|---|---|---|---|
dir_create() |
Creates the target directory if it does not already exist. | path:str |
None |
dir_list() |
Lists all entries in the target directory. | path:str |
list |
dir_is_directory() |
Checks whether the target path is a directory. | path:str |
bool |
dir_delete() |
Deletes the target directory. Removes recursively if non-empty. | path:str |
None |
dir_is_empty() |
Checks whether the target directory is empty. | path:str |
bool |
dir_size() |
Returns the total size of the target directory in bytes, recursively. | path:str |
int |
dir_size_mb() |
Returns the total size of the target directory in megabytes, recursively. | path:str |
float |
Archive Functions
| Function Name | Description | Arguments | Returns |
|---|---|---|---|
zip_create() |
Creates a zip archive from file or directory. | path:str, targetpath:str |
None |
zip_extract() |
Extracts a zip archive to target path. | path:str, targetpath:str |
None |
zip_is_zipfile() |
Checks if file is a valid zip archive. | path:str |
bool |
zip_list() |
Returns list of files inside zip archive. | path:str |
list |
zip_append() |
Appends a file to a zip archive. | zip_file:str, file:str |
None |
tar_create() |
Creates a tar archive from directory. | path:str, targetpath:str |
None |
tar_extract() |
Extracts a tar archive to target path. | path:str, targetpath:str |
None |
tar_list() |
Returns list of files inside tar archive. | path:str |
list |
tar_remove() |
Removes a target file from a tar archive. | path:str, target:str |
None |
tar_append() |
Appends a file to a tar archive. | tar_file:str, file:str |
None |
Encryption Functions
| Function Name | Description | Arguments | Returns |
|---|---|---|---|
enc_encrypt_file() |
Encrypt target file. | path:str,targetpath:str,key:bytes,mode:str |
None |
enc_decrypt_file() |
Decrypt target file. | path:str,targetpath:str,key:bytes,mode:str |
None |
Only AES256 algorithm support, modes: CTR, CBC, CFB, ECB, GCM, OFB
Utility Functions
| Function Name | Description | Arguments | Returns |
|---|---|---|---|
destroy_newline() |
Removes newline characters from text. | data:str |
str |
lmap() |
Only: list(map(...)) | func:function,lst:list |
list |
copy_to_clipboard() |
Copy text on clipboard | text:str |
None |
encrypt_bytes() |
Encrypt target bytes. (Only GCM) | data:bytes,key:bytes |
bytes |
decrypt_bytes() |
Decrypt target bytes. (Only GCM) | data:bytes,key:bytes |
bytes |
Project Repo Github • Project Repo PyPI
Author Github Profile • Author PyPI Profile
--Batuhan Şenol
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyfastfile-0.7.1.tar.gz.
File metadata
- Download URL: pyfastfile-0.7.1.tar.gz
- Upload date:
- Size: 43.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce11f49362856d9309c25b4424ecbc596067414fcfbf7d10b9b0fb33c8fe532e
|
|
| MD5 |
efd46feeeaad511a5957234e3af5040a
|
|
| BLAKE2b-256 |
8bbad75a5e3d3e53384d767cb9e7c6b2731821141ff7f3348503e4f83e289277
|
File details
Details for the file pyfastfile-0.7.1-py3-none-any.whl.
File metadata
- Download URL: pyfastfile-0.7.1-py3-none-any.whl
- Upload date:
- Size: 62.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cdf46695a5111d516af2082543d3dbe8c907f9cfcf835a1ae50b1c9554cda3c
|
|
| MD5 |
a826ee0cc604f7840961756b8df387dd
|
|
| BLAKE2b-256 |
9ca6de9052fdc4ba975768e8cca0637562361993d68ba1d15b582313e9665a22
|