0

We have -C option in linux to remove the absolute path. I am trying to achieve the problem in Node.js

tar.create({
        gzip: true,
        file: 'test.tar.gz'
    },
    ['../result/1670341264809/test/']
).then(_ => {
});

but with the above code it is creating the tar file with all absolute path, but I need tar file only from test folder. How to add the flag in node-js module.?

mkHun
  • 5,891
  • 8
  • 38
  • 85

1 Answers1

0

I found the solution, we have to add path in cwd, then provide the directory name on folder array

tar.create({
        gzip: true,
        file: 'test.tar.gz',
        cwd: "../result/1670341264809/",
    },
    ['test']
).then(_ => {
    signedPkgName = remoteDir + "testaddon.tar.sign.gz";
    transferFileToRemote();
});
mkHun
  • 5,891
  • 8
  • 38
  • 85