End of file in JavaScript

xiaoke picture xiaoke · Oct 1, 2012 · Viewed 12k times · Source

I want to read a local file line by line in JavaScript. Ut I can check if it goes to the end of this file. For example:

file = new ActiveXObject("Scripting.FileSystemObject"); 

// Sets the variable "f" to equal the new open file contents 

f = file.OpenTextFile("c:\\wantlist.txt", 1); 
s = f.ReadLine()

While(s != EOF)
{
    //. Do some thing 
    s = f.ReadLine()
}

What is EOF should be in JavaScript? Or do you have another way to deal with this problem? Thank you very much!