You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/08/29 14:48:56 UTC

[GitHub] [cordova-plugin-file] Jeremy38100 opened a new issue #341: Low performance when read large file with cordova-plugin-file

Jeremy38100 opened a new issue #341: Low performance when read large file with cordova-plugin-file
URL: https://github.com/apache/cordova-plugin-file/issues/341
 
 
    am creating a hybrid app with Angular 7, Ionic 4 and Cordova.
   
   I need to read a large file (> 1GB) located on Android file system but i am facing a performance issue. With the current implementation i have a speed about **2.5 MB/sec**.
   
   Is it an issue with the plugin itself or the implementation ?
   
   I tried to modify BLOB_SIZE but the maximum speed i obtained was 2.5 MB/s.
   
   ```typescript
   const BLOB_SIZE = 1024*1024;
   
   usbRead(fileEntry: FileEntry) {
         fileEntry.file((file) => {
           const reader = new FileReader();
   
           reader.onload = () => {
             const buffer = new Uint8Array(reader.result as ArrayBuffer);
             readCounter += buffer.byteLength;
             console.log(textDecoder.decode(buffer));
             offset += BLOB_SIZE;
             if (offset >= file.size) {
               console.log('end');
               return;
             }
             const slice = file.slice(offset, offset + BLOB_SIZE);
             reader.readAsArrayBuffer(slice);
           };
   
           reader.readAsArrayBuffer(file.slice(0, BLOB_SIZE));
         });
       });
     }
   ```
   I tested on Xiaomi Redmi Note 7 with Android 9
   
   My package.json has the following plugin version :
   `@ionic-native/file": "^5.12.0"`
   
   - [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
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org