filejoin-js
v0.0.26
Published
easy file merging tool
Downloads
6
Readme
filejoin-js
filejoin-js
is a Node.js application used to merge multiple files into a single one
Installation
npm -g install filejoin-js
Command-Line Options:
-c <path to config.json>
-r <path to a root directory>
-t <long pooling refresh time for watching>
-rcwd (if this is set and no root file is defined, root file will be current directory)
-watch (enable this to start long pooling check)
-debug (use this for debug mode writing)
Config file sample:
[
{
"out": "sample1.txt",
"in": [
"input1.txt",
"input2.txt",
"input3.txt"
]
},
{
"out": "sample2.txt",
"in": [
"input1.txt",
"input2.txt",
"input3.txt"
]
}
]
Command-Line Samples:
Create a one-time build
filejoin -c /user/config.json -r /myproject
Create a watcher:
filejoin -c /user/config.json -r /myproject -watch -debug
Create a watcher with files and config.json in current folder:
filejoin -rwcd -watch
Code Sample:
var FileMerger = require('filejoin-js').FileMerger;
var merger = new FileMerger([
{out: 'sample2.txt', in: ['input1.txt', 'input2.txt']},
{out: 'sample2.txt', in: ['input1.txt', 'input2.txt']}
], '/examples/', true);
// since version 0.0.18:
merger.onWatcherUpdate = function() {
console.log('some update done');
};
merger.doMerge();
customize the watcher behaviour by keeping cache data: (since version 0.0.24)
var merger = new lib.FileMerger(config, path, true);
merger.keepCache = true;
function selfWork() {
merger.doMerge();
setTimeout(function() {
selfWork();
}, 1000);
}
selfWork();
merger.onWatcherUpdate = function(args) {
console.log('some update done for file ' + args.outputName);
};
merger.onCheckFinished = function() {
console.log('check finished tick!');
}
retrieve existing config file for other operations: (since version 0.0.24)
var merger = new lib.FileMerger(config, path, true);
console.log(merger.getConfig());
GNU General Public License
Copyright (C) 2014 Alexandru Stefan
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.