Jump to content

File handling in JS


Recommended Posts

I found these online.....

 

// READ //

fh = fopen(getScriptPath(), 0);

if (fh!=-1) {

    length = flength(fh);   

    str = fread(fh, length);

    fclose(fh);

    write(str);   

}

 

// WRITE //

function WriteFile() {

    var fh = fopen("c:\\MyFile.txt", 3); // Open the file for writing

    if (fh!=-1) {

        var str = "Some text goes here...";

        fwrite(fh, str);

        fclose(fh);

    }

}

WriteFile();

 

Hope this helps

Link to comment
https://forums.phpfreaks.com/topic/237632-file-handling-in-js/#findComment-1221081
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.