AFAIK, write access directly from JavaScript is impossible, and it is this way for security reasons.
It looks like there is a possibility to perform write access using Java:
http://www.javascripter.net/faq/writinga.htm#top .
I've been thinking of a possibly using JavaScript as a general purpose scripting language - like Perl/Python/Ruby. I think JavaScript libraries are actively being developed, so the language can become convenient for general purpose tasks.
So, my question is: has anybody developed an extension at source level for an FOSS JavaScript implementation (I guess Firefox/Mozilla JavaScript is such an implementation) ?
I.e. if to along this way one will have to have a locally compiled such JavaScript interpreter with file write access.