How to read text file?


I tried to read text from local. This is my code.

ReadFiles() { var filedir = this.file.dataDirectory ; this.file.listDir(filedir,'recordtext').then((files)=> { var i =0 ; for( let myfile of files){ this.file.readAsText(filedir,myfile.fullPath.substr(1)).then((contents)=>{ this.pushArray.push(this.getSubStr(contents)); this.txtNames.push(myfile.fullPath.substr(1)); }) } }); }

This is the url of source <a href="https://www.dropbox.com/s/fnh20dyivzaui1b/FileSaveRead.rar?dl=0" rel="nofollow">https://www.dropbox.com/s/fnh20dyivzaui1b/FileSaveRead.rar?dl=0</a>

I can't read file with this code when I installed apk ,first time. but i reinstall apk without uninstalling the apk, it can read file. Please help if you have know reason. Regards.


In the index.html I moved src="build/polyfills.js" up

<script src="build/polyfills.js"></script> <script src="cordova.js"></script>

And the problem is solved.


  • reading a web api blob into a string that I can send as part of a json object to the server and turn
  • How to synchronize two onloadend functions in angular 2?
  • Javascript FileReader readAsText function not understaning utf-8 encoding characters like ä and ö
  • SQLException: the result set is closed
  • Include in project programmatically
  • Setting php.ini variables inside web.config on IIS 7.5
  • How to retrieve values stored in JSON array in MySQL query itself?
  • Elastic Beanstalk failed to update local Git configuration - Windows
  • ssh2_scp_send() using php corrupts pdf
  • Performing way to limit double accuracy
  • std::string::substr throws std::out_of_range but the arguments are in limit
  • C++ how to get substring after get position of its index
  • Where does the file get saved using “File file = new file(filename)” in Android
  • How to trick Node.js to load .js files as ES6 modules?
  • How to handle empty space in url when downloading image from web?
  • WP7 difficulties binding data to listbox itemssource - won't refresh
  • Ruby 1.8.6 Array#uniq not removing duplicate hashes
  • Configure Spring's MappingJacksonHttpMessageConverter
  • AppleScript : find open tab in safari by name and open it
  • Regex to match a string not followed by anything
  • Uncaught TypeError: $(…).select2 is not a function
  • Why cepheus don't send int without quotes to orion?
  • Element.tagName for python not working
  • How can I speed up CURL tasks?
  • Do I need to reset a Perl hash index?
  • Display images in Django
  • How to render a blob on a canvas element?
  • How to create a file in java without a extension
  • Seeking advice on Jetty HttpClient Hang
  • Why is an OPTIONS request sent to the server?
  • Spring security and special characters
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Circular dependency while pushing http interceptor
  • AngularJs get employee from factory
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?