MCPcopy Index your code
hub / github.com/TeleBoxOrg/TeleBox_Plugins / saveSpeedtestImage

Function saveSpeedtestImage

speedtest/speedtest.ts:988–1010  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

986}
987
988async function saveSpeedtestImage(url: string): Promise<string | null> {
989 try {
990 const imageUrl = url + ".png";
991 const response = await axios.get(imageUrl, { responseType: "arraybuffer" });
992 const imagePath = path.join(TEMP_DIR, "speedtest.png");
993 const filledImagePath = path.join(TEMP_DIR, "speedtest_filled.png");
994 fs.writeFileSync(imagePath, response.data);
995
996 const bgColor = "#212338";
997 const borderPx = 14;
998 try {
999 await fillRoundedCorners(imagePath, filledImagePath, bgColor, borderPx);
1000 return filledImagePath;
1001 } catch (err) {
1002 console.error("Failed to fill rounded corners:", err);
1003 }
1004
1005 return imagePath;
1006 } catch (error: any) {
1007 console.error("Failed to save speedtest image:", error);
1008 return null;
1009 }
1010}
1011
1012async function convertImageToStickerWebp(
1013 srcPath: string

Callers 1

trySendFunction · 0.70

Calls 3

errorMethod · 0.80
fillRoundedCornersFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected