-1

I have to read a file from the file system of my phone. Essentially its to check if the file contains a word. The file is located in the /sys folder of my phone. I know I can get the contents of the File using FileReader.readAsText(file) to get the contents as a string and then parse it for the word. But how do I make the "file" object to pass to the FileReader object. Thanks in advance!

Edit: Just wanted to add here:

Can I use the File constructor here?

var file = File("/path/to/file");

taz
  • 43
  • 4
  • You can't read a file directory from the file system - a user has to select the file and place it in a . You can then read the file using FileReader – fbonetti Sep 08 '14 at 16:26
  • http://blog.teamtreehouse.com/reading-files-using-the-html5-filereader-api – fbonetti Sep 08 '14 at 16:26
  • The problem is that this code is a part of a controller file for gecko. It doesnt have any related HTML file. And I need to read just one file in whose path can be hardcoded. – taz Sep 08 '14 at 16:30
  • Could you tell exactly which file in `/sys/` you're trying to open? Maybe there is a different solution using API that can get the values you're trying to obtain. – Loïc Faure-Lacroix Sep 13 '15 at 08:00

1 Answers1

1

You can only read data from your app folder (via XMLHttpRequest) and from the SD Card. You cannot read data from any other place in a Firefox OS app.

Jan Jongboom
  • 26,598
  • 9
  • 83
  • 120