I am developing a function in Javascript using FileSystemObject, where I just have to write in a file the binary data we are provided. 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();
}
Nevertheless it doesn't always work (error on f2.Write(data)). I guess it is because one or both reasons: - Write function does not accept binary data (ASCII from 0-255) - There is a maximum size for "data" in f2.Write(data)
Could you help me, please?
UPDATE:
I get this error (translated): Message: Argument or call to function not valid Which technology should I use, then, if Javascript doesn't work with plain block 8 bit values?
FileSystemObject
is notably limited, even for writing UTF-8 files satisfactorily I have had to resort to another solution:ADODB.Stream
http://www.w3schools.com/ADO/ado_ref_stream.asp