项目作者: afeiship

项目描述 :
Fetch resource to base64.
高级语言: JavaScript
项目地址: git://github.com/afeiship/next-fetch2base64.git
创建时间: 2019-06-13T03:46:22Z
项目社区:https://github.com/afeiship/next-fetch2base64

开源协议:MIT License

下载


next-fetch2base64

Fetch resource to base64

installation

  1. npm install -S afeiship/next-fetch2base64 --registry=https://registry.npm.taobao.org

apis

api params description
request - Fetch file/image link to data base64

usage

  1. import NxFetch2base64 from 'next-fetch2base64';
  2. NxFetch2base64.request('https://a.com/t7ec442a38.png').then(response=>{
  3. document.getElementById('image').src = response;
  4. });

configuration

  • IMAGE CORS
  1. ; nginx configuration
  2. ; https://tu-dev.finxos.com/tu-resources/xxx/2019_04_18/slfjfsdl.png
  3. location /tu-resources/ {
  4. add_header Access-Control-Allow-Origin *;
  5. }