# Read big files in chunks - WebkitBlobResource error 1 on iOS

**URL:** <https://forum.ionicframework.com/t/read-big-files-in-chunks-webkitblobresource-error-1-on-ios/213167>\
**Category:** Capacitor\
**Created:** [July 31, 2021, 6:51am UTC](https://forum.ionicframework.com/t/read-big-files-in-chunks-webkitblobresource-error-1-on-ios/213167 "2021-07-31T06:51:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dwynr](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dwynr](https://forum.ionicframework.com/u/Dwynr)\
**Post date:** [July 31, 2021, 6:51am UTC](https://forum.ionicframework.com/t/read-big-files-in-chunks-webkitblobresource-error-1-on-ios/213167/1 "2021-07-31T06:51:36Z")

</div>

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:

```auto
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)

```

---

<div class="post-metadata">

**Author:** ![Tommertom](https://avatars.discourse-cdn.com/v4/letter/t/ed8c4c/32.png) [@Tommertom](https://forum.ionicframework.com/u/Tommertom)\
**Post date:** [July 31, 2021, 4:37pm UTC](https://forum.ionicframework.com/t/read-big-files-in-chunks-webkitblobresource-error-1-on-ios/213167/2 "2021-07-31T16:37:37Z")

</div>

[https://bugs.webkit.org/show\_bug.cgi?id=197441](https://bugs.webkit.org/show_bug.cgi?id=197441)

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

---

<div class="post-metadata">

**Author:** ![Dwynr](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dwynr](https://forum.ionicframework.com/u/Dwynr)\
**Post date:** [July 31, 2021, 5:05pm UTC](https://forum.ionicframework.com/t/read-big-files-in-chunks-webkitblobresource-error-1-on-ios/213167/3 "2021-07-31T17:05:02Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![Dwynr](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dwynr](https://forum.ionicframework.com/u/Dwynr)\
**Post date:** [August 1, 2021, 7:18am UTC](https://forum.ionicframework.com/t/read-big-files-in-chunks-webkitblobresource-error-1-on-ios/213167/4 "2021-08-01T07:18:08Z")

</div>

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](https://bugs.webkit.org/show_bug.cgi?id=228683)

This can be closed.
