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

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.5.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

file_operations-1.0.5-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file file_operations-1.0.5.tar.gz.

File metadata

  • Download URL: file_operations-1.0.5.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for file_operations-1.0.5.tar.gz
Algorithm Hash digest
SHA256 159de58eb2690ee6b2a777825abead35ea79165a1af4dd8127461c4d47acbdd3
MD5 4b3a1bd3af50aae8992b98fb3e0d7e5a
BLAKE2b-256 1996b341bbedebf00849c198073a8a7961338575884a15e896e2655fd50c9b14

See more details on using hashes here.

File details

Details for the file file_operations-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: file_operations-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for file_operations-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b4636c1e401cf74eed81577563ff9e58b8196511edb1602c95fcb865742edfb0
MD5 41a4e9b412e72b36312a297ed6fa598b
BLAKE2b-256 50e49de54f11e9cbeca1641f6e2d69cbde0179d99e1a432b4ceae43a125cb8d7

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page