Skip to content

Instantly share code, notes, and snippets.

@Wyru
Created June 17, 2021 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Wyru/f0e1ec5685da2fdcaafacecde7edc370 to your computer and use it in GitHub Desktop.
Save Wyru/f0e1ec5685da2fdcaafacecde7edc370 to your computer and use it in GitHub Desktop.
Example of how convert a image to base64 with js
const Axios = require('axios').default;
const handle = async() => {
const response = await Axios.get("https://game-icons.net/icons/ffffff/000000/1x1/lorc/robe.svg");
const base64 = Buffer.from(response.data).toString('base64');
console.log(base64);
}
handle();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment