(url: string)
| 986 | } |
| 987 | |
| 988 | async 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 | |
| 1012 | async function convertImageToStickerWebp( |
| 1013 | srcPath: string |
no test coverage detected