files#
File handling utility functions.
- windtalker.files.get_encrypted_path(original_path: Union[str, Path, Path], suffix: str = '-encrypted') Path [source]#
Find the output encrypted file /dir path (by adding a suffix).
Example:
file:
${home}/test.txt
->${home}/test-encrypted.txt
dir:
${home}/Documents
->${home}/Documents-encrypted
- windtalker.files.get_decrypted_path(encrypted_path: Union[str, Path, Path], suffix: str = '-encrypted') Path [source]#
Find the original path of encrypted file or dir.
Example:
file:
${home}/test-encrypted.txt
->${home}/test.txt
dir:
${home}/Documents-encrypted
->${home}/Documents
- windtalker.files.transform(src: Union[str, Path, Path], dst: Union[str, Path, Path], converter: Callable, overwrite: bool = False, stream: bool = True, chunksize: int = 1048576, **kwargs)[source]#
A file stream transform IO utility function.
- Parameters:
src – original file path
dst – destination file path
converter – binary content converter function
overwrite – default False,
stream – default True, if True, use stream IO mode, chunksize has to be specified.
chunksize – default 1MB