apache / cordova-plugin-file-transfer

Apache Cordova File Transfer Plugin
https://cordova.apache.org/
Apache License 2.0
598 stars 885 forks source link

[discussion] Why is this plugin deprecated? #266

Closed markdegrootnl closed 4 years ago

markdegrootnl commented 4 years ago

With the new features introduced in XMLHttpRequest, this plugin is not needed any more. Migrating from this plugin to using the new features of XMLHttpRequest, is explained in this Cordova blog post. -- https://github.com/apache/cordova-plugin-file-transfer#deprecated

Sure downloading data as a blob or arraybuffer and saving it using cordova-plugin-file works perfectly fine, however there is one big caveat.

I've run several tests downloading a 70MB file and two things stand out:

  1. Downloading the file and saving it to the device' storage is significantly slower using XHR and the File plugin compared to the FileTransfer plugin. I'll elaborate on this later on.
  2. When trying to improve the download speed, I've tried downloading the file as a Blob and a ArrayBuffer. Blob works, however slow. Downloading as ArrayBufer results in a memory exhaustion with just a 70 MB download.

Now for some cold hard facts:

The main reason for this massive difference in performance lies in the fact that the FileTransfer plugin executes the entire process in native code and probably uses streams to download and save the file in one single step. The proposed alternative using XHR downloads the entire file in javascript first and sends the entire data Blob to the native File plugin to save the data to storage.

So in conclusion: Why is this plugin deprecated if the proposed alternative is notably slower?

timbru31 commented 4 years ago

Please see https://github.com/apache/cordova-plugin-file-transfer/issues/258#issuecomment-662907931 - your input on the mailing list would be appreciated.

markdegrootnl commented 4 years ago

Hi @timbru31 I've added my input to the mailing list but is does not appear on the page. Does this take a while?

timbru31 commented 4 years ago

Yes, might take a bit. I’ve already got an email. Thanks!

markdegrootnl commented 4 years ago

Hi @timbru31 My input still hasn't been added to the mailing list page. Any idea why?

dpa99c commented 4 years ago

Note: after a PMC vote, this plugin has been undeprecated

ssledorze commented 4 years ago

PMC ?

dpa99c commented 4 years ago

Apache Project Management Commitee - in the case the Cordova PMC