Simple API for performing file and directory operations
Project description
File Operations
Simple python API for performing directory and file-based operations.
Installation
You can install the file_operations
library with the following command:
pip install file_operations==1.0.5
Then import into your program as:
import file_operations
def main():
data = "aabaaba"
src_file = "hello.src"
dest_file = "hello.dest"
file_operations.write_file(src_file, data, mode='w')
file_operations.copy_file(src_file, dest_file)
if __name__ == '__main__':
main()
API Architecture
The following discusses the available methods in this library:
read_bytes(src_file, offset, limit)
copy_file(src_file, dest_file)
write_file(dest_file, data, mode ='w', overwrite = False)
move_file(src_file, dest_file)
remove_file(src_file)
create_dir(dest_dir)
copy_dir(src_dir, dest_dir, overwrite = False)
move_dir(src_dir, dest_dir)
remove_dir(dest_dir)
buffered_reader(file_name, buffer_size, mode ='rb'):
buffered_reader.has_next()
buffered_reader.read()
buffered_reader.close()
The _file
methods require both src_file
and dest_file
to be formatted as path/file_name.extension
.
Note the buffered_reader
is a class which is used for reading a large file in chunks, the size of each chunk is buffer_size
.
If an operation is successfully applied, then the function returns True
and False
otherwise.
For coding interview preparation, please visit [algorithmspath.com] (https://algorithmspath.com).
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
Built Distribution
Hashes for file_operations-1.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4636c1e401cf74eed81577563ff9e58b8196511edb1602c95fcb865742edfb0 |
|
MD5 | 41a4e9b412e72b36312a297ed6fa598b |
|
BLAKE2b-256 | 50e49de54f11e9cbeca1641f6e2d69cbde0179d99e1a432b4ceae43a125cb8d7 |