itinance / itinance/react-native-fs

"Subscription.listener.apply is not a function" Error thrown when stoping download when "resumable" is True

Open
#429 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

This is pretty odd and I think I've managed to narrow it down to the use of `resumable: true` as an option for `RNFS.downloadFile`.

Here is my test code:

```

let job = RNFS.downloadFile({
fromUrl: `${URL}`,
toFile: `${FILEPATH}`,
resumable: true,
background: true,
discretionary: false,
progressDivider: 1,

progress: (result) => {
console.log(result)
},

});

job.promise.then((result) => {
console.log('COMPLETE')
console.log(result)
});

job.promise.catch((error) => {
console.log('ERROR')
console.log(error)
});

function myFunction() {
console.log('STOP!')
RNFS.stopDownload(job.jobId);
}
setTimeout(myFunction, 2000);

```

When `RNFS.stopDownload()` is called we get a fatal error `Subscription.listener.apply is not a function`, when `resumable` is False then its fine.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.