( pastedContents: Record<number, PastedContent>, )
| 82 | * Store all images from pastedContents to disk. |
| 83 | */ |
| 84 | export async function storeImages( |
| 85 | pastedContents: Record<number, PastedContent>, |
| 86 | ): Promise<Map<number, string>> { |
| 87 | const pathMap = new Map<number, string>() |
| 88 | |
| 89 | for (const [id, content] of Object.entries(pastedContents)) { |
| 90 | if (content.type === 'image') { |
| 91 | const path = await storeImage(content) |
| 92 | if (path) { |
| 93 | pathMap.set(Number(id), path) |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | return pathMap |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Get the file path for a stored image by ID. |
no test coverage detected