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/01/29 14:46:39 UTC

[GitHub] sambegin commented on issue #240: Support for other File constructors

sambegin commented on issue #240: Support for other File constructors
URL: https://github.com/apache/cordova-plugin-file/issues/240#issuecomment-458566318
 
 
   @firesharkstudios @janpio  I'd say it is the same on every platform (iOS tested here). I dig a little bit in the actual code and in this repo's issues (https://github.com/apache/cordova-plugin-file/issues/277,  https://github.com/apache/cordova-plugin-file/issues/260) and the only problem here is the file() function from FileEntry [is not returning a real File object](https://github.com/apache/cordova-plugin-file/blob/master/www/FileEntry.js#L83) which implements Blob. I had the same issue trying to upload the File returned by the "file()" function to firebase (which supports uploading a Blob) but always getting rejected because the object is not a real Blob.  
   
   The only way to do it is to "re read" the file to get the actual byte or data_url and upload it as a string which is memory and computing intensive for nothing. 
   
   It was also very hard to find this since in your documentation + in the code, you seem to always talk about the File object like if it would be a Blob but it is not. I think you should at least mention it in the documentation + [change your class name File for CordovaFile](https://github.com/apache/cordova-plugin-file/blob/master/www/File.js#L31) or something specific to your plugin to make sure everyone understand this. 
   
   Maybe I miss something ? If this is the case, how can we get a real File --> Blob from this plugin (from a FileEntry) without having to manually convert it ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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