node package manager

file-appender

file-appender

travis build codecov coverage version downloads MIT License semantic-release

Pipe a list of files to a transform stream.

Sometimes you have a lot of files, and want to pipe them all to a writable stream. Instead of writing code, having to care about edge cases and everything, just use file-appender.

Install

npm install file-appender

Usage

Pipe a list of files to an output file:

var appender = require('file-appender');
 
var output = require('fs').createWriteStream('./output.txt');
 
appender(['./foo.txt', './bar.txt']).pipe(output);

It also works if you pass a path to a directory, like:

appender('./someDir').pipe(output);

It won't check if the files in the respective directory are text files, or even another directory. In this case, make sure it contains just the files you want to pipe.

It doesn't make much sense to do this, but it still work if you pass just a string with the path to a single file:

appender('./foo.txt').pipe(output);

License

Licensed under the MIT license