-async function downloadImage (url: string, destDir: string, destName: string, size: { width: number, height: number }) {
- const tmpPath = join(CONFIG.STORAGE.TMP_DIR, 'pending-' + destName)
- await doRequestAndSaveToFile(url, tmpPath)
-
- const destPath = join(destDir, destName)
-
- try {
- await processImage(tmpPath, destPath, size)
- } catch (err) {
- await remove(tmpPath)
-
- throw err
- }
-}
-