(fullPath: string)
| 148 | * Processes an image file and returns the result |
| 149 | */ |
| 150 | export async function processImageFile(fullPath: string): Promise<ImageProcessingResult> { |
| 151 | const imageStats = await fs.stat(fullPath) |
| 152 | const { dataUrl, buffer } = await readImageAsDataUrlWithBuffer(fullPath) |
| 153 | const imageSizeInKB = Math.round(imageStats.size / 1024) |
| 154 | const imageSizeInMB = imageStats.size / (1024 * 1024) |
| 155 | const noticeText = t("tools:readFile.imageWithSize", { size: imageSizeInKB }) |
| 156 | |
| 157 | return { |
| 158 | dataUrl, |
| 159 | buffer, |
| 160 | sizeInKB: imageSizeInKB, |
| 161 | sizeInMB: imageSizeInMB, |
| 162 | notice: noticeText, |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * Memory tracker for image processing |
no test coverage detected