The following sample code illustrates how to access files using Rapise:

function Test()
{
    //IOMode constants
    var IOMode_ForReading = 1;
    var IOMode_ForWriting = 2;
    var IOMode_ForAppending = 8;

    //var Format constants
    var IOFormat_ASCII = 0;
    var IOFormat_Unicode = -1;

    //This sample demonstrates how to manipulate the Windows file system using Rapise
    //We shall open a text file for writing in this simple example

    var fso = new ActiveXObject('Scripting.FileSystemObject');
    var ts = fso.CreateTextFile('C:\\Temp\\MyTestFile.txt');
    ts.Close();

    var file = fso.GetFile('C:\\Temp\\MyTestFile.txt');
    ts = file.OpenAsTextStream(IOMode_ForWriting, IOFormat_Unicode);
    ts.WriteLine('Hello World!');
    ts.Close();
    Tester.Message('Wrote File');

    //Now read this file back
    file = fso.GetFile('C:\\Temp\\MyTestFile.txt');
    ts = file.OpenAsTextStream(IOMode_ForReading, IOFormat_Unicode);
    var text = ts.ReadLine();
    Tester.Message(text);
    ts.Close();
}