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
Then import into your program as:
import file_operations.file_ops as file_ops
def main():
data = "aabaaba"
src_file = "hello.src"
dest_file = "hello.dest"
file_ops.write_file(src_file, data, mode='w')
file_ops.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()
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
file_operations-1.0.0.tar.gz
(2.1 kB
view hashes)
Built Distribution
Close
Hashes for file_operations-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6cef1cdbbf9c2caba1a270341a78bfe283786fbd94fb3f684c8925af2d47d4cc |
|
MD5 | a35c5d657dec55fecd4dade0ac99145e |
|
BLAKE2b-256 | e349ddf804db05614899c9dc976d604cde9f68df71c93d2dab13263fcaf61b24 |