MIT licensed source code:
https://github.com/eligrey/FileSaver.jsIn case it's not clear, this allows you to generate a file from client-side JS, and allow the user to save the generated file without first having to upload the generated file to the server.