(url: string)
| 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 | |
| 1005 | async 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) |
no test coverage detected