How to generate downloadable files from clients side data

Hi guys! I’m a newbie to Meteor and I need help here. I want to achieve a functionality that when you click on the button, a file can be downloaded. And the contents of the file is generated from the user input on the browser. I can get the content of the input but I have no idea how to achieve the downloading function here. Anyone here can help me a bit? Thanks

Quite a few unanswered questions here. What kind of file? How do you get your content into that file? What are you really trying to achieve overall?

If you can get your content into a blob, here is a pattern that I use to generate a download (presumably on a click event):

var blob = new Blob([yourBlob], {
  type: "application/octet-stream"
});
var a = window.document.createElement("a");
a.href = window.URL.createObjectURL(blob, {
 type: "data:attachment/xlsx"
});
a.download = 'download.xlsx';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);

The file format is .fbs. Since it’s a special kind of format, I’m thinking about maybe just generation a txt but with the special format.

The content is what the user input in the page. I can get all the information needed with jquery and store them into a session or even into a collection.

The main goal of my project is kind of the file generator. There’s a table on the page, and the user can input the information, then click the button, they can get the corresponding fbs file they want.

Maybe check out https://www.npmjs.com/package/write?