writefile is a Firefox extension [1] which waits for an event from the current page and upon receiving notification of that event writes the contents of the calling element to a new file on the computer running the browser.
The source and a download link can be found on Bitbucket.
[1] https://developer.mozilla.org/en/Extensions
Update 2012-12-26
An example of using this extension can be found here: https://gist.github.com/4383852