Hi All,
I'm trying to read a simple .txt file from within my controller script, does anyone know if / how
this is possible?
There are all kinds of ways of reading files in Javascript but they all seem to be possible only within webbrowsers. Javascript is not my primary language so I'm kind of new to this and cannot find a
solution.
Cheers,
whizzl
Is it possible to read text files from controller scripts?
-
- KVRist
- 39 posts since 21 Mar, 2013
yes, here's one way to do it:
"test.txt" would then be in your home-directory
source: https://apimeister.com/2015/06/12/read- ... n-jjs.html
Code: Select all
var filename = "test.txt";
var content = new java.lang.String(
java.nio.file.Files.readAllBytes(
java.nio.file.Paths.get(filename)
)
);
println(content);source: https://apimeister.com/2015/06/12/read- ... n-jjs.html
- KVRist
- 207 posts since 23 Oct, 2008
post deleted. decided to make this a separate thread.
