MCPcopy Create free account
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 const filledImagePath = path.join(TEMP_DIR, "speedtest_filled.png");
987 fs.writeFileSync(imagePath, response.data);
988
989 const bgColor = "#212338";
990 const borderPx = 14;
991 try {
992 await fillRoundedCorners(imagePath, filledImagePath, bgColor, borderPx);
993 return filledImagePath;
994 } catch (err) {
995 console.error("Failed to fill rounded corners:", err);
996 }
997
998 return imagePath;
999 } catch (error: any) {
1000 console.error("Failed to save speedtest image:", error);
1001 return null;
1002 }
1003}
1004
1005async function convertImageToStickerWebp(
1006 srcPath: string
1007): Promise<string | null> {
1008 try {
1009 if (!fs.existsSync(srcPath)) return null;
1010 const stickerPath = path.join(
1011 TEMP_DIR,
1012 `speedtest_sticker_${Date.now()}_${Math.random()
1013 .toString(36)

Callers 1

trySendFunction · 0.70

Calls 3

errorMethod · 0.80
fillRoundedCornersFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected