0

I want to unzip a password protected zip file in windows using nodejs and I'm using tar command to do this via node child process. The problem is, there is a prompt to enter the password but I can't find a way to pass the password that stored in the pwd variable.

const pwd = 'password';
exec(`tar -xf ${filePath}}`,callback);

  function callback(err,stdout,stdin){
    if(err){
      console.log(err);
      return;
    }
  • tar does not support passwords. Use other utils -like zip – Sachin Apr 10 '21 at 02:34
  • Does this answer your question? [Use tar to compress file tar.gz with password](https://stackoverflow.com/questions/24734101/use-tar-to-compress-file-tar-gz-with-password) – Sachin Apr 10 '21 at 02:34
  • I'm creating an electron app for windows so I don't think zip command is available on windows by default –  Apr 10 '21 at 02:39

0 Answers0