Skip to main content

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

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

file_operations-1.0.3.tar.gz (2.1 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.3-py3-none-any.whl (1.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: file_operations-1.0.3.tar.gz
  • Upload date:
  • Size: 2.1 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.3.tar.gz
Algorithm Hash digest
SHA256 08712d8b06a154156cb1934419f2c322490d9df92323fe46db1270bf71fe314d
MD5 ce5c8d49e9bdb0b01013cfb0fc85fa1e
BLAKE2b-256 90d19c9bf8c9173251eada077415bf9e76a2705f98758abd319308019f5f2d56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: file_operations-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 1.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b9dde79e13abc855099dc32658af1a96314f0fffb671895a81125b5cdc510c8d
MD5 461b2e6fc6564221c607541517e9ac52
BLAKE2b-256 2998d34fb8bc3069a301650207be1822e7e5187b11e721f221c12f8a5f0eae18

See more details on using hashes here.

Supported by

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