Should 'ionic run browser' work with cordova-plugin-file?

I’m trying to debug file handling inside my app by running it in the browser with ‘ionic run browser’. but it seems that the cordova.js doesn’t really provide a file system emulation as i can’t seem to get a file to write anywhere. console.log(JSON.stringify(this.file)) produces:

{“cordovaFileError”:{“1”:“NOT_FOUND_ERR”,“2”:“SECURITY_ERR”,“3”:“ABORT_ERR”,“4”:“NOT_READABLE_ERR”,“5”:“ENCODING_ERR”,“6”:“NO_MODIFICATION_ALLOWED_ERR”,“7”:“INVALID_STATE_ERR”,“8”:“SYNTAX_ERR”,“9”:“INVALID_MODIFICATION_ERR”,“10”:“QUOTA_EXCEEDED_ERR”,“11”:“TYPE_MISMATCH_ERR”,“12”:“PATH_EXISTS_ERR”,“13”:“WRONG_ENTRY_TYPE”,“14”:“DIR_READ_ERR”}}

So it seems it’s more of a dummy object. Is there a way to debug file system things with the browser? I don’t really like recompiling the whole app and transferring it to a physical device as my dev server is remote…

Thanks for any pointers here

browser isn’t a real platform and should be avoided.

For something like that you are going to have to either use the emulator/simulators or go real device. You could insert Ionic Deploy into your app to allow for faster redeploys.

1 Like

i was afraid you’d say that. hoped that the cordova ppl would have built some filesystem functions to at least test basic dataDirectory file creations etc. . thankx

The browser is sandboxed from the file system (for the most part). You can look at using my Ionic Native Mocks to help you out: https://github.com/chrisgriffith/ionic-native-mocks

Curiosity called me and I started to read the plugin docs. It seems the only truly cross-platform way to handle files with the plugin is using the cordova.file.tempDirectory feature. At expense, of course, of some degree of vulnerability.