node js 解压rar格式文件
作者:互联网
nodejs调用WinRAR解压
var cp = require("child_process"); function unZIP(winRarPath, password, zipFilePath, unZipFolder) { return new Promise(async (resolve, reject) => { cp.execFile(winRarPath, ["x", "-inul", `-p${password}`, zipFilePath, unZipFolder], function (err, stdout, stderr) { if (err) { reject(err) } resolve(stdout) }) }) } async function main(){ try { let result = await unZIP("C:\\Program Files\\WinRAR\\WinRAR.exe", '111111', "D:\\test\\新建文本文档.rar", "D:\\test"); console.log('解压成功') } catch (error) { console.log(error) } } main()
标签:node,function,unZipFolder,err,格式文件,解压,rar,WinRAR 来源: https://www.cnblogs.com/xfweb/p/16475346.html