Neanderthals Programming Machines

npm

npm’s 2019 JavaScript ecosystem survey analysis is now available! Get your copy here »

get-image-base64

1.0.1 • Public • Published

get-image-base64

Github License Github Stars

use canvas api get images base64, all currently only support browsers.

Use

import getImageBase64 from 'get-image-base64';
 
getImageBase64('https://avatars1.githubusercontent.com/u/8198408?s=40&v=4', base64Str => {
  console.log(base64Str)
}, 'jpeg', 1)
 
// output:
// data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAAoACgDAREAAhEBAxEB/8QAGQAAAwEBAQAAAAAAAAAAAAAABwkKBggF/8QAJxAAAQUBAAICAQUAAwAAAAAAAwECBAUGBwgREhMUABUWISIJIzT/xAAcAQACAgMBAQAAAAAAAAAAAAAGBwMFAQQIAAL/xAAwEQABAwIGAAUCBgMBAAAAAAABAgMRBCEABRIxQVEGEyJhcYGRFDJDUrHwJDPR4f/aAAwDAQACEQMRAD8Ad7ufIK7psTxaD/IJrb/VRZ+6mNHMP7LJl/uGhc1zkKi/jhdJGgmo34IEQBt/yz9TwlRICQD0BHuSOf7zImXyyVrsRff2m29tp+uCdpO2zY1dxgLr0yrPp0tTK+ad32tjxD2aGcv2tV7kSpcnye5VX05VT379xuBDcBSZMAgb2PMi3yN/bGAmSpCQSsC/Fjv7RHM/XCacV1rpvRp1hsKG2uSu530HW7e7vz3U59VnYkzt4oUE5hJKak8pMxkwRo9eF7WgjkKkooBuVhRrOMw8jMchaC/KFVVPJACiPMlsoAgbeokQdpidsG2TZQl7Ls2WtvWUULYbBEkLIUuR7lMn27OwN87yO1+SrNSO33d3azA+ZmdpRlfOWOx9LIu50wbGAj/UIUdwT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0uASdSRYTMGTYwfuNqP5XacKywNRksJ9baqsKQAj6ac4di05EjsGwo47PvkFarXq1rXCjBCiHeMgfTuhiCklKgQoEggggggwQQbgg2INwccyNokJcSQpKgFIUkpKVJIlKgbghQ2IkEEEGL4JoSAuIYo5ILJQpwCy/x5kdEceE+Oz4xZqyxKByESS1io0KK3/TSKz17Ji3Ikf3ucRNCHFqkhc7hXEgxHV4PEW9zlm9UZxihmQ9mt1N5lJfJbVWyxpNtK59OedANppzY7XynY6SV4BUMxQyDVMhw4Uo37WSISIL+JsrXV5e+qnYQ88B6UKElUg3Tb8wg7bg3NjgpyGoQusZCnvKklS1pVp9KSCZPMibHfjEwvnX5jaDz1747xh5eDS5fhGPvAV/SJVlAs6G/6NfwpDETKrWyBCso2XinVH2caTCDJtJLBsez8RokIsafJhkNM5muYpaFV5aiwyblo3AIRaFgkXkK0/GHbT1AeZaapXdbDyvUpMkKSkAG4MbbiT9sP18MfGSi8eMTD0dyFkO3fFijap0CMNVEYGKMMNjEGMIHsRjPua32IKucJpHO+16jrDNTWVLboaL5fqEaDBUsrWYSlPJN4SkXJJAvfEeZV7Xlv0iVtMsNMrU8pZSgANySoqJACUgSVG1iSTGP/9k=

install

npm i get-image-base64

Downloadsweekly downloads

3

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability