file-chopper
v1.0.5
Published
split and merge files using nodejs, npm & js
Downloads
5
Maintainers
Readme
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);
});