我无法提取 .zip 文件

I can't extract an .zip file

我正在尝试从 discord 下载一个 .zip 文件并使用解压包进行解压,但是 return 没有任何错误并且不解压包。 (文件正在正确保存和下载)

const decompress = require('decompress');
client.on("message", (msg) => {
  if (msg.author.id === process.env.REIS_ID) {
    if (msg.channel.id === config.channel_commit) {
      if (config.file_status === 0) {
        if (msg.attachments.first()) {
          download_files(msg.attachments.first().url).then(res => {
            console.log(res);    
          });
        }
      } else {
        msg.reply("Upload ainda em processo.");
      }
    }
  }
});
const download_files = async (url) => {
  const stream = got.stream(url);
  const file_ext = FileType.fromStream(stream).then(async (res) => {
    got
      .stream(url)
      .pipe(
        fs.createWriteStream("./testes/a/new." + res.ext, { overwrite: true})
      );
    console.log(res.ext);
    if (res.ext === "zip") {
      console.log("zip file");
        const files = await decompress("./testes/a/new.zip", "./testes/a/new/");
    }
  });
};

解法: 我从 npm 下载 unzip 模块并使 zip 文件不保存到文件夹中,请求直接保存提取的文件。

代码:


client.on("message", (msg) => {
  if (msg.author.id === process.env.REIS_ID) {
    if (msg.channel.id === config.channel_commit) {
        if (msg.attachments.first()) {
          let res = download_files(msg.attachments.first().url);
        }
    }
  }
});

const download_files = (url) => {
  const stream = got.stream(url);
  const file_ext = FileType.fromStream(stream).then(async (res) => {
    got
      .stream(url)
    console.log(res.ext);
    if (res.ext === "zip") {
        got.stream(url).pipe(unzip.Extract({ path: "./testes/a/new/" }));
    } 
  });
};