Javascript - create text file on website

前端 未结 5 660
庸人自扰
庸人自扰 2021-01-29 07:39

So I have a web page, and I would like to programaticly create a text file (lets say it has the words \'hello, I am a text file\' in it) on a new directory on my website. The pr

5条回答
  •  清酒与你
    2021-01-29 07:58

    You can use ActiveXObject, but it won't work in all browsers.

    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var a = fso.CreateTextFile("c:\\testfile.txt", true);
    a.WriteLine("This is a test.");
    a.Close();
    

    https://msdn.microsoft.com/en-us/library/5t9b5c0c(v=vs.84).aspx

提交回复
热议问题