cordova-plugin-file icon indicating copy to clipboard operation
cordova-plugin-file copied to clipboard

File, FileReader, Blob, ArrayBuffer are replacing Javascript native code instead of extending it.

Open LucasBourgeois opened this issue 2 years ago • 6 comments
trafficstars

Bug Report

Problem

Many of this plugin classes are overriding Javascript native classes instead of implements them properly

What is expected to happen?

Plugin Blob, File, ArrayBuffer, FileReader classes should not replace Javascript native code and extend native JS API's

What does actually happen?

For exemple, if i do a const file = new File([], 'yoyo'), I can't use Blob() functions like file.arrayBuffer() as File isn't extending Blob interface. Also, file.name is an array containing a Blob item.

It cause unexpected behavior between browser web native Javascript File implementation and phone device cordova one. In addition, we must add trash code to handle this.

Information

https://developer.mozilla.org/en-US/docs/Web/API/Blob https://developer.mozilla.org/en-US/docs/Web/API/File https://developer.mozilla.org/fr/docs/Web/API/FileReader

Command or Code

Just init a new File() or an new ArrayBuffer() and compare them with browser result, they are not as Javascript define them.

Environment, Platform, Device

Cordova-android 11, Android 13 device, Chrome.

Version information

    "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

LucasBourgeois avatar Jun 26 '23 15:06 LucasBourgeois