View Single Post
Old 06.06.2019, 12:18
bobolecoco bobolecoco is offline
JD Alpha
Join Date: Aug 2015
Location: France
Posts: 24

Originally Posted by bingo View Post
Hi ,

i would like a script that would allow me to download just a small chunk of lots of files (maybe 1 or 10 MB) (and possibly auto delete them afterwards as well)

Is something like this what you want ?
var numberOfMB = 10

for (i = getAllDownloadLinks().length - 1; i >= 0; i--) {
    if (getAllDownloadLinks()[i].getBytesLoaded() > numberOfMB * 1024 * 1024) {
It will check if more than (here 10) MB of the file are already downloaded. If that's the case, it will disable the link.

You can add this line (after or instead of "getAllDownloadLinks()[i].setEnabled(false);") :
It will remove the link from the download list.

You can also look for the deleteFile() method to erase the downloaded file in combination with the getPath() method.
Reply With Quote