我需要下载一个。并将其转换为 base64格式。我使用 Axios 作为我的 HTTP 客户端。我尝试过向服务器发出 git 请求并检查 response.data
,但它似乎不是这样工作的。
链接到 Axios: https://github.com/mzabriskie/axios
与 Base64实施工作的链接: https://www.npmjs.com/package/base-64
我正在使用 NodeJS/React,因此 atob/btoa 不能工作,所以使用了库。
axios.get('http://placehold.it/32').then(response => {
console.log(response.data); // Blank
console.log(response.data == null); // False
console.log(base64.encode(response.data); // Blank
}).catch(err => console.log(err));