I would like to read file in Java Script. The best it would be to read line by line, but there is also possibility to read the whole file at once. Generally on the web there is quite a lot of implementations, but I would like to read a file in very simple way by entering, hardcoded path and file name in the Java Script code, not but any buttons or something like this. The pseudo code below:
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var file = FileReader("home/test.txt");//hardcoded path and name of the file
var listOfLines = [];
var line = file.readLine();
while(line != eof) {
listOfLines.push(file.readLine());
file.readLine();
}
</script>
</body>
</html>
Is there such possibility to do something like this. Thank you.