Added functionality to save to file.

Only tested in Chrome so far.