file-chopper

1.0.5 • Public • Published

file-chopper

chopper split and merge files in multiple parts.

Installation

To Install Globally

npm i -g file-chopper --save

To Install Locally

npm i file-chopper --save

Up To Date

All methods support latest Promise feature of ECMAScript Using BlueBird Promise Library.

Split files with input parts

file-chopper(file) => Promise<string[]> 

string[] is an array containing names of all partition files.

Input:

  • file: Path to the file to split.
  • Int: No of files to create from original file

Returns:

  • Promise<string[]>: Promise with string[] array containing full paths of all created files.

Example:

const file-chopper = require('file-chopper');
 
file-chopper.splitFile(__dirname + '/fileName', Integer)
  .then((names) => {
    console.log(names);
  })
  .catch((err) => {
    console.log('Error: ', err);
  });

Merge parts

mergeFiles(names, outputFile) => Promise<>

Inputs:

  • names: String[] array with full part paths.
  • outputFile: Full path of the output file to be created.

Returns:

  • Promise<>: Promise that results in an empty resolving.

Example:

const file-chopper = require('file-chopper');
 
file-chopper.mergeFiles(names, __dirname + '/testfile-output.bin')
  .then(() => {
    console.log('Done!');
  })
  .catch((err) => {
    console.log('Error: ', err);
  });

Package Sidebar

Install

npm i file-chopper

Weekly Downloads

0

Version

1.0.5

License

ISC

Unpacked Size

341 kB

Total Files

6

Last publish

Collaborators

  • bhavayanand