Download many images without halting the app to a grind

Hi all!

I’ve successfully built an app that is mainly for music and movie library purposes. It all works quite well, i scan in the library, which is very fast, after that i download images from LastFM for all the artists and albums, finally i store them using cordova file. The problem is that in case someone has a large library, it takes a long time and the performance of the mobile device drops quite a lot. Is there a way to transfer the images in a low priority thread? Or some other method?

Thanks for any advice!

I found this too but limiting the concurrent image downloads to 4 by implementing a “queue” eased this.

Work through the full list by calling a routine that removes the first 4 entries from the list and calls a promise for each to download, add the returned promise to an array and then using $q.all(promisesarray).then() to call the same routine recursively until none are left.

Sorry unable to provide actual code as it belongs to my employer.

Thanks for replying, your reply gave me some direction. I’ll try that!