1

I'm trying to push many files in a big tar archive; I will use either ZLIB, BZ2, or LZMA to compress the files. I really want to use streams so I can check the progress as fast as possible.

So basically if I compress 1 file with ZLIB it should be like?

const gzip = zlib.createGzip();
fs.createReadStream(input).pipe(tarSomethinMaybe?).pipe(gzip).pipe(where?)

How do I add more files in the same archive.tar.gz? Do I need to concat all these pipes of individual files?

Thank you!

Cristi Constantin
  • 554
  • 1
  • 6
  • 19
  • Should help http://stackoverflow.com/questions/21981919/compressing-multiple-files-using-zlib – Nazar Sakharenko Aug 09 '16 at 17:08
  • @NazarSakharenko: That question is actually not answered. The person asked the same question as me, but didn't get an answer. Compressing each file in a separate tar.gz archives is easy, the complicated thing is to concat all the files in one big archive. – Cristi Constantin Aug 09 '16 at 21:41
  • 1
    There are links in second answer, first to https://github.com/mafintosh/tar-stream module, second - http://stackoverflow.com/questions/15530435/node-js-zip-unzip-a-folder with solution how to compress forlder. You can do the same - move files to dir, and use method from link 2. Or, as alternative - https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback with tar command. – Nazar Sakharenko Aug 10 '16 at 13:16

0 Answers0