How would I know the file is “complete” after it exists?

I am a normal nextcloud user with no access to the next cloud backend server. From another app(non-nextcloud) I generate a file (everything happens in the backend, I see nothing) which is uploaded by the app to the cloud. Sadly the app doesn’t provide a way of knowing when the file is done uploading so I do sequential HTTP GETs, to test it exists in the cloud. The GETs errors out until the file exists after which I immediately try to download it and I succeed except that I am doing it too fast because I get only ~20mb of it while the file is ~100mb

How would I know the file is “complete” after it exists? Maybe some properties of the file I can query?

simple approach would be just to add some delay before download once the file was detected - you still don’t know if the file is complete, but you could guess how long the upload needs if your upload performance is known and remains stable.

more complex and stable solution would be to add a loop with short delay after the file is detected - and check file size… then start download only if the size (or update time) remains unchanged for reasonable time frame (depending on the upload performance).

1 Like

Tyvm for taking the time to reply with a concept. I choose to implement the 2nd one and it actually works quite well since the file gets written (uploaded) at a speed/time, sequential PROPFINDs calls to <d:getetag/> or <d:getcontentlength/> produce different result from the previous value.

1 Like