const axios = require('axios')
let url = 'https://cbu01.alicdn.com/img/ibank/2019/043/806/11230608340_1371494418.120x120.jpg';
function getBase64 (url) {
return axios
.get(url, {
responseType: 'arraybuffer'
})
.then(response => new Buffer.from(response.data, 'binary').toString('base64'))
}
getBase64(url)
.then(ret => {
console.log(`data:image/jpg;base64,${ret}`)
})