Skip to main content
Glama
convertImageToBase64.js502 B
import axios from "axios"; export const convertImageUrlToBase64 = async (imageUrl) => { try { // Fetch the image as a binary buffer const response = await axios.get(imageUrl, { responseType: "arraybuffer" }); // Convert the binary data to base64 const base64Image = Buffer.from(response.data, "binary").toString("base64"); return base64Image; } catch (error) { throw new Error(`Failed to convert image to base64: ${error.message}`); } };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Letz-AI/letzai-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server