Read big files in chunks - WebkitBlobResource error 1 on iOS

Not sure if this is the correct place to ask, but I hope someone is able to tell me whats going on.

I’m trying to read a rather big file in chunks using FileReader (File selected from an field). Works fine on Android, but somehow on iOS the FileReader stops reading the chunks exactly after 60 seconds. The error I am seeing is WebkitBlobResource error 1. Makes me wonder if this is some kind of permission error or something else.

Sample code:

let file = <input type="file">

let chunkSizeToUse = (1024 * 1024) // 1 MB chunks
let offset = (0 - chunkSizeToUse)

let readInterval = setInterval(() => {
	if(offset < file.size){
		offset += chunkSizeToUse

		let fileReader = new FileReader()

		fileReader.onload = () => {
			let arrayBuffer = fileReader.result

			//further chunk processing
		}

		fileReader.onerror = (err) => {
			console.log(err) // WebkitBlobResource error 1 exactly after 60 seconds of processing
		}

		fileReader.readAsArrayBuffer(file.slice(offset, (offset + chunkSizeToUse)))
	}
	else{
		clearInterval(readInterval)
	}
}, 100)

https://bugs.webkit.org/show_bug.cgi?id=197441

A bit of google search narrows it to a safari issue - likely

Yes I’ve been googling all day and also found others reporting this issue. Strangely it works fine on my Mac running Desktop Safari. Only mobile Safari (or the WKWebview in this case) seems to be the issue.

For everyone who wants to test it: https://jsfiddle.net/L17uymvp
This fiddle will select a file, wait 70 seconds and then attempt to read it from the input field. It will always fail on mobile safari.

Looks like this is indeed a bug with the webkit engine on iOS, bug filed: 228683 – WebKitBlobResource error 1 exactly after 60 seconds when trying to read file input

This can be closed.