Indicate offset to Background URL file upload session?

I'm looking at using "tus" to upload large files. This protocol allows for pause and resume.

My thought is to start the upload in the foreground while the app is running. But its going to take 10 minutes and the user is bored, so they background the app. At this point, the app has sent say 100M of data (using fileUpload with a normal URLSession).

I have 30 seconds to get some background task going, so what I'd like to do is submit the file upload to a URL Session, and indicate (through some magic property) that I want the upload task to use a Range of data in the file, not the whole file.

Is this possible?

The problem is that otherwise, I have to just send the whole file, or duplicate the file more or less with the first 100M not duplicated. These are close to 1G file so prefer not to do that.

Ideas most welcome!
Answered by DTS Engineer in 626345022

Is this possible?

No. The lack of this feature makes it tricky to implement resumable uploads of large files because, on resuming an upload, you have to copy the file to remove the bytes that you’ve uploaded so far.

A filed a bug requesting that uploads support a file offset a while ago (r. 30418199) but it wouldn’t hurt if you filed your own enhancement request for this.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer

Is this possible?

No. The lack of this feature makes it tricky to implement resumable uploads of large files because, on resuming an upload, you have to copy the file to remove the bytes that you’ve uploaded so far.

A filed a bug requesting that uploads support a file offset a while ago (r. 30418199) but it wouldn’t hurt if you filed your own enhancement request for this.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
FB8335267

A second idea, again probably flawed. I see that APFS supports file "clones", that when first created allows one file to be a clone of another. From then on, edits to the cloned file will change the area modified, but leave much of the file the same.

The big question: how to "trim" leading bytes from the clone, while leaving the rest of the file pointing to the original. My guess is this is impossible, but maybe not - comments?

David

My guess is this is impossible

Correct.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Indicate offset to Background URL file upload session?
 
 
Q