const axios = require('axios'); const db = require('../../db'); module.exports = async function(db, itemImages, adminUUID) { for (const item of itemImages) { const {uuid, name, images} = item; console.log(` Downloading images for item: ${name}`) for (const imageName of images) { const url = `https://societyofsocks.us/media/${imageName}` console.log(' Downloading ' + url) const response = await axios.get(url, { responseType: 'arraybuffer' }) await db.item.addImage(uuid, response.data, adminUUID); } } }