About file handling in Javascript on Linux
I'm developing an addon for Firefox browser. My addon is intended to work on Linux platform specifically. 开发者_Go百科How can I handle a file in Javascript on Linux? I've Googled a lot on this and all I got was file handling in Javascript on Windows using ActiveX objects. Is there any way to do the same on Linux? The type of file I wanted to create and handle is just text.
The Mozilla Development Center has some really great reusable XPCOM components for managing files. Check out the nsIFile component documentation below:
Reading, writing files: https://developer.mozilla.org/en/Code_snippets/File_I//O#Navigating_with_.0ansIFile
General information on nsIFile: https://developer.mozilla.org/en/Code_snippets/File_I//O#nsIFile_and_path_strings
In short, when developing a Firefox Add-on, your JavaScript has special permissions when loaded in the XUL markup using a "chrome URL". This JavaScript can read and write to the filesystem natively, for Windows, Mac, and Linux. Thus, there is no need to use Flash or any third-party plug-ins.
精彩评论