从 axios *.pdf 下载到 base64 编码的 arraybuffer 不正确

问题描述

我从直接链接下载了带有 axios 的 pdf 并将其编码为 base64,但是当我将其解码为 pdf 时它不起作用。

这是我目前的代码:

axios( {
      method: 'get',url : shareLink,headers : { responseType: 'arraybuffer' }
    } ).catch((err)=>{
      console.log(err)
      })
    .then((response)=>{
        console.log("Downloading & encoding files",response.status);
        const encoded = new Buffer.from(response.data).toString('base64');
        attachments.push({
          "Name": fileName,"Content": encoded,"ContentType": "application/octet-stream"
        })
      }))

This is my sharelink 如果我在 https://base64.guru/converter/encode/pdf 对文件进行编码,它看起来不同,它的反斜杠和 + 符号要少得多。它在解码 https://base64.guru/converter/decode/pdf 后肯定有效。

那么我怎样才能使这项工作正常进行?

这就是编码的样子: https://pastebin.com/PAuxxDsH

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)