I want to save the contents of a canvas element to a file.
I came across this wonderful library for saving html5 canvas elements to image file
You import 2 JS libraries, get the canvas from the DOM, and call this function:
Canvas2Image.saveAsPNG(canvas);
The user will get a save dialog.