apache / apache/cordova-plugin-file
Large file save freeze app for seconds
- Dominant language
- JavaScript
- Stars
- 744
- Forks
- 754
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 1
Description
# Bug Report
## Problem
### What is expected to happen?
On large file save (> 5mb) app freeze for seconds.
Its pause render in my app, and animations start lag and jump.
### What does actually happen?
No freeze or lag in render on file save.
## Information
### Command or Code
```javascript
const save = (data, filename) => {
const onErrorHandler = e => console.error('file save error ', filename, e);
window.resolveLocalFileSystemURL(cordova.file.externalDataDirectory, dirEntry => {
dirEntry.getFile(filename, { create: true, exclusive: false }, fileEntry => {
fileEntry.createWriter(fileWriter => {
fileWriter.onwriteend = () =>
console.log('Successful file write ', filename);
fileWriter.onerror = onErrorHandler;
fileWriter.write(data);
}, onErrorHandler);
}, onErrorHandler);
}, onErrorHandler);
};
```
### Environment, Platform, Device
- Galaxy S8 / android 9
- Mi A2 Lite / android 9
### Version information
- cordova: 9.0.0
- cordova-android: 8.1.0
- cordova-plugin-file: 6.0.2
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start with the JavaScript save function in the issue and reproduce the reported freeze using a file larger than 5 MB on the listed Android devices and versions. Compare rendering and animation during fileWriter.write(data); done means saving completes without blocking rendering or causing visible animation lag.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100