Feature #65822

Free space feedback from plugins to core

Added by raztoki over 5 years ago. Updated over 5 years ago.

Status:ClosedStart date:05/30/2015
Priority:NormalDue date:
Assignee:-% Done:


Target version:020 - Next Release 2.0


some plugins like youtube, mega require effectively 2 * the free space because
- youtube: downloads dash parts then mux together, then deletes dash parts after successful mux.
- mega: downloads encrypted component, which gets deleted after successful decrypt.

First approach

download selector evaluates if a given plugin requires x free space in order to start the download task.

create method like canHanle to evaluate downloadlinks free space needs.

boolean requiredFreeSpace(DownloadLink downloadLink) {
  // requires plugins to have semi valid filesize value set
  if (dl.isdash() && dowloadlink.getSize() > 0) {
    return doessavepathhavefreespacerequired(downloadLink, 2 * downloadLink.getSize())
  } else {
    return super;

Second approach

make methods to call free space checker, so we can call from plugins. As in download finishes we recheck free space requirement before post download event to prevent failure. Since user could be downloading or extracting in JD or other programs the available free space no available to perform task when its going to fail!

booelan isSpaceFreeToPerformPostDownloadTask(DownloadLink downloadLink) { 
  // since we already have half the data ! we need ~approx another one half again (although decrypted component should be smaller than encrypted)
  return doessavepathhavefreespacerequired(downloadLink, downloadLink.getSize());
boolean doessavepathhavefreespacerequired(DownloadLink, long) {
  // determine save path
  return 'check path for free space value' > long;


this is required to reduce over all IO and CPU cycles in events which cannot be performed successfully, which would then throw exception.


Also available in: Atom PDF