Skip to main content

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

Metadata

Release files for file-operations 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for file-operations 1.0.5
File Size Uploaded
file_operations-1.0.5.tar.gz 3.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for file-operations 1.0.5
File Interpreter ABI Platform
file_operations-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 7.9 kB

Release files / file_operations-1.0.5.tar.gz

Download URL file_operations-1.0.5.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
159de58eb2690ee6b2a777825abead35ea79165a1af4dd8127461c4d47acbdd3
BLAKE2b-256 checksum
How to use checksums
1996b341bbedebf00849c198073a8a7961338575884a15e896e2655fd50c9b14
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

Release files / file_operations-1.0.5-py3-none-any.whl

Download URL file_operations-1.0.5-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4636c1e401cf74eed81577563ff9e58b8196511edb1602c95fcb865742edfb0
BLAKE2b-256 checksum
How to use checksums
50e49de54f11e9cbeca1641f6e2d69cbde0179d99e1a432b4ceae43a125cb8d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page