Writing binary data using FileSystemObject write ()

I am developing a function in Javascript using FileSystemObject, where I just need to write the binary data that we provided to the file. This is my function.

function exportFile(data)
{   
    var fso, f2;
    fso = new ActiveXObject("Scripting.FileSystemObject");
    f2=fso.CreateTextFile("C:\\example.js",true);
    f2.Write(data);
    f2.Close();
}

However, it does not always work (error on f2.Write (data)). I think this is because one or both reasons: - The write function does not accept binary data (ASCII from 0 to 255) - The maximum size for "data" in the file is f2.Write (data)

could you help me?

UPDATE:

I get this error (translated): Message: argument or function call is invalid What technology should I use if Javascript does not work with regular block 8-bit values?

+5
1

FileSystemObject , UTF-8 : ADODB.Stream

http://www.w3schools.com/ADO/ado_ref_stream.asp

+3

All Articles