我正在尝试在窗口终端中解压缩受密码保护的zip文件。但是我得到了错误 “错误:'zip'无法识别为内部或外部命令, 可操作的程序或批处理文件。”
var spawn = require('child_process').spawn;
let filePath = "XXX/XX";
let password= "abc";
extractZipWithPassword(filePath,password)
function extractZipWithPassword(filePath,password) {
console.log("Inside here:::::::::::::::::::",filePath);
var dir = spawn('zip',['-P',password,'-j','-',filePath],{shell:true});
dir.stderr.on('data',(data) => {
console.log('Error: '+data);
return filePath;
})
dir.on('close',(code) => {
console.log("On closing:::::::::::::::")
return filePath;
});
}