const axios = require('axios');
var fs = require('fs');
axios.get('http://zhangqiang.win/img/random/2.png', {
responseType: 'arraybuffer'
})
.then(function(response) {
console.log(response.status);
console.log(response.headers);
fs.writeFile('out.png', response.data, function (err) {
if (err) throw err;
console.log('保存成功');
});
});```
使用axios读取远程图片保存到本地
最新推荐文章于 2024-05-09 14:46:33 发布