Search code examples
javascriptrhino

Read file with Rhino


Is it possible with Rhino Server-side Javascript to locate and read the contents of an arbitrary local file?


Solution

  • Sure is.

    from interpreter:

    js> readFile('./tmp.txt');
    

    or in code:

    var filesz = readFile('./tmp.txt');