...

/

Exercise: File Concatenation

Exercise: File Concatenation

Practice how to write a callback function that contains concatenated data of all the source files.

Problem statement

Write the implementation of a concatFiles() named callback-style function that takes two or more paths to text files in the filesystem and a destination file.

function concatFiles (srcFile1, srcFile2, srcFile3, ... ,
dest, cb) {
// ...
}

This function should copy the contents of every source file into the destination file, respecting the order of the files, as provided by the arguments list.
For instance, given two files, if the first file contains foo and the second file contains bar, the function should write foobar (and not barfoo) in the ...