Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including file-appender with all npm packages installed. Try it out:

var fileAppender = require("file-appender")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

file-appender v1.1.0

Pipe a list of files to a transform stream.

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

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free