Skip to main content

a simple CLI tool to split a file into several smaller chunks at data level and merge them back

Project description

Naive File Splitter

Naive File Splitter (NFS) is a simple CLI tool to split a file into several smaller chunks at data level and merge them back. It does not compress or transform the original file in any way. NFS only reads the file in binary stream and writes it into chunks whose number or size is given by the user.

By having smaller chunks of a file instead of a large one, it allows easier and faster data download and upload, and bypasses file size limits inplaced by some cloud providers.

NFS works with any file format.

Install

NFS requires Python >= 3.5.

pip install nfs-estepona

Upon installation, a new nfs binary will be added to system's path.

Command

Split

Usage

nfs split [OPTIONS] SRC

Split the file into several chunks by specifying EITHER:

  • number of chunks with --chunk flag
  • size of each chunk with --size-per-chunk flag, and the number of chunks is calculated accordingly, i.e. 5kb, 10mb, 1gb

SRC is the filepath.

Options:

  • -c, --chunk, INTEGER, number of chunks to output
  • -s, --size, TEXT, size of each chunk

Example

Split a file into 5 chunks

nfs split -c 5 /mnt/c/Users/estep/Videos/Captures/mgs1.mp4

$ nfs split -c 5 /mnt/c/Users/estep/Videos/Captures/mgs1.mp4
100%|█████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 37.28it/s]
splitted /mnt/c/Users/estep/Videos/Captures/mgs1.mp4 into 5 chunks
Split a file into chunks of 25MB each

nfs split -s 25mb /mnt/c/Users/estep/Videos/Captures/medium.webm

$ nfs split -s 25mb /mnt/c/Users/estep/Videos/Captures/medium.webm
100%|███████████████████████████████████████████████████████████████████████████████████| 18/18 [00:08<00:00,  2.00it/s]
splitted /mnt/c/Users/estep/Videos/Captures/medium.webm into 18 chunks

Merge

Usage

nfs merge [OPTIONS] SRC

Merge NFS splitted file chunks into one.

NFS splitted file chunks can be identified with .c1, .c2 (etc.) appended to the end of original file's name (path).

If multiple files that are splitted are found, user can choose which one to merge.

If the original file exists under the same directory, a new file with _copy appended to the filename will be created.

SRC is the directory path that contains (parent to) splitted file chunks.

Options:

  • -r, --remove, remove splitted file chunks after merge

Example

Merge splitted file chunks into one

nfs merge /mnt/c/Users/estep/Videos/Captures

$ nfs merge /mnt/c/Users/estep/Videos/Captures
100%|█████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 50.87it/s]
merged splitted file chunks to /mnt/c/Users/estep/Videos/Captures/mgs1_copy.mp4
Merge splitted file chunks into one and remove chunks

nfs merge -r /mnt/c/Users/estep/Videos/Captures

$ nfs merge -r /mnt/c/Users/estep/Videos/Captures
100%|█████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 49.96it/s]
merged splitted file chunks to /mnt/c/Users/estep/Videos/Captures/mgs1_copy.mp4
removed splitted file chunks
Merge splitted file chunks into one where chunks of other files exist

nfs merge /mnt/c/Users/estep/Videos/Captures

$ nfs merge /mnt/c/Users/estep/Videos/Captures
found 2 splitted file chunks, choose one to proceed:
1 - dup.mov
2 - mgs1.mp4
your answer: 2
100%|█████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:00<00:00, 47.95it/s]
merged splitted file chunks to /mnt/c/Users/estep/Videos/Captures/mgs1_copy.mp4

Author

Binghuan Zhang - esteponawondering@gmail.com

LICENSE

MIT

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

nfs-estepona-0.2.4.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

nfs_estepona-0.2.4-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file nfs-estepona-0.2.4.tar.gz.

File metadata

  • Download URL: nfs-estepona-0.2.4.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for nfs-estepona-0.2.4.tar.gz
Algorithm Hash digest
SHA256 8aef704fdaa799765a98661ed1b6ab36bc4313dfc1ec0f5e728cb4e98a8d5eef
MD5 958d1ab0df66080b87de1734b46d0834
BLAKE2b-256 1c0035d400e8c01f46f0756442e672b9383674676974bd403cf2fa11e80125f7

See more details on using hashes here.

File details

Details for the file nfs_estepona-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: nfs_estepona-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for nfs_estepona-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ade07a3e283218b1fdb5e9ef93129571dfb4e9b145609058a6142082f6bf760e
MD5 bae9cbc44da22f8b438e9179671c4e4c
BLAKE2b-256 9021791a594b0018c2e7b137a5eaee1e19ee9dcb434409dce5f6935bacdff3a7

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