Download remote images error at specific number of images
thuatz opened this issue · comments
thuatz commented
View: src/utils/downloadImagesInBatches.ts
Function: downloadImagesInBatches
const batches = Math.ceil(imagesURLs.length / batchSize); // determine the number of batches
for (let i = 0; i < batches; i++) {
const start = i * batchSize; // calculate the start index of the batch
const end = Math.min(imagesURLs.length, start + batchSize); // calculate the end index of the batch
const batchURLs = imagesURLs.slice(start, end); // slice the URLs for the current batch
const batchFileNames = imageFileNames.slice(start, end); // slice the file names for the current batch
if (batchFileNames[i].fullPath === undefined) {`
If 231 images, we have 12 batches. Then last patch has only 11 images (index from 0 to 10). Then it throws error at i = 11