How to read and write into file using JavaScript?

后端 未结 17 2717
孤街浪徒
孤街浪徒 2020-11-22 02:00

Can anybody give some sample code to read and write a file using JavaScript?

17条回答
  •  一个人的身影
    2020-11-22 02:34

    For Firefox:

    var file = Components.classes["@mozilla.org/file/local;1"].
           createInstance(Components.interfaces.nsILocalFile);
    file.initWithPath("/home");
    

    See https://developer.mozilla.org/en-US/docs/Code_snippets/File_I_O

    For others, check out the TiddlyWiki app to see how it does it.

提交回复
热议问题