
Thanks to FileSaver.js you will be able to save the data of a file in JavaScript as a download in your browser easily. FileSaver.js implements the saveAs FileSaver interface in browsers that do not natively support it. FileSaver.js is the solution to saving files on the client-side, and is perfect for webapps that need to generate files, or for saving sensitive information that shouldn't be sent to an external server. Visit the official repository at Github for more information about this library. If you use NPM, you can install it in your project using: npm install file-saver -saveĪnd then you can just require the module as: var FileSaver = require('file-saver') This library has support with UMD (Universal Module Definition) so you can use it in the browser and access it from the window or you can require it as a module with any bundler. You will need the FileSaver library to achieve your goal.


For the examples we are going to use a PDF hosted in the Mozilla Github IO website, that is absolutely free and has CORS headers, so it can be used everywhere to test.
