Fetch resource to base64.
Fetch resource to base64
npm install -S afeiship/next-fetch2base64 --registry=https://registry.npm.taobao.org
api | params | description |
---|---|---|
request | - | Fetch file/image link to data base64 |
import NxFetch2base64 from 'next-fetch2base64';
NxFetch2base64.request('https://a.com/t7ec442a38.png').then(response=>{
document.getElementById('image').src = response;
});
; nginx configuration
; https://tu-dev.finxos.com/tu-resources/xxx/2019_04_18/slfjfsdl.png
location /tu-resources/ {
add_header Access-Control-Allow-Origin *;
}