Simon Fraser wrote:
>
> I need to read in a file in JS, perferably a line at a time, using an
> nsIFile. How to do this?
Here is an example from file.js
js> load('file.js');
js> var p='/home/petejc/fooBar';
js> var f=new File(p);
js> f.open();
true
js> while(!f.eof())
print(f.readline());
line #1
line #2
line #3
line #4
line #5
line #6
line #7
line #8
line #9
line #10
js>
- How to read the contents of an nsIFile in JavaScript Simon Fraser
