Back

ReadFile

Hello World

Reads a file from the local filesystem and returns its contents.

app.ReadFile( file, encoding )

See also: WriteFile

Example - Append file and get line count

function OnStart()
{
    app.WriteFile( "myFile.txt", "Hello World from Copy\n", "Append" );

    var txt = app.ReadFile("myFile.txt");
    var length = txt.split("\n").length;
    app.ShowPopup("myFile contains " + length + " lines");
}
    Copy     Copy All       Run      
string: path to file or folder ( “/absolute/...” or “relative/...” )
string: “US-ASCII” or “UTF-8” or “UTF-16” or “UTF-16BE” or “UTF-16LE” or “windows-1252” or ISO-8859-1 or “base64”