Open Filirom1 opened 12 years ago
This would be a good idea for an fstream extension. (That is, a child class that inherits from Reader, but lives in its own repo/package.)
The question would be whether it's a merge, or just copies the two folders over as siblings. It would be pretty easy to do something like this:
CombinedReader.prototype.append = function (entry) {
this.emit('entry', entry)
}
then the Writer will put them out as siblings.
But it sounds like what you really want is for the entries to be merged together. So, if the added Reader is a dir, then any entry events get emitted as entry events, and if it's not a Directory, then just emit a single entry event.
fstream.CombinedReaders()
.append(fstream.Reader(someDir))
.append(fstream.Reader(someFile))
.pipe(options.tar ? tar.Pack() : fstream.Writer(outDir))
So, then, that'd combine the contents of someDir, along with someFile, in either the tarball or the outDir.
Thank you, I will try. I will close this issue with a gist or something like that, if somebody need it.
Hi,
Is there a way to combine fstream Readers, into one Writer ?
For example I would like to pipe two different folders into a new one.
The ideal would be to do something like this:
Or should I use the events do do it manually ?
BTW fstream looks really great, but the doc is quite thin :)