How to use tar-fs

Comprehensive tar-fs code examples:

How to use tar-fs.pack:

23
24
25
26
27
28
29
30
31
32
33
34
35


function targz(files) {
  return new Promise((resolve, reject) => {
    console.log("targz files: ", files[0].name, files[0]);


    const tarStream = tar.pack();


    for (const file of files) {
      tarStream.entry({ name: file.name }, file.data);
    }

How to use tar-fs.extract:

30
31
32
33
34
35
36
37
38
39
40
41
 */
function extractTarFile(filePath, destinationPath, callback) {
  var streamError;


  // Prepare the extractor with destination path
  var extractor = tar.extract(path.normalize(destinationPath));


  var onError = function(error) {
    streamError = error;
    extractor.end();