0

I am new to ember (and stackOverflow) and have an issue that I am trying to work through. I have a model for a list of items that I am able to add into, update, and delete and everything on that end works fine. What I would like to do is to try and take the items in the model and write them into a formatted text file to download.

The model data is fine.
I know I can use this code to download a file from a url: < a href="urlFile" download="filename">

I just don't see any guides that can get me from the model to the download and I was wondering if anyone has any suggestions that could point me in the right direction. Thanks.

Red fx
  • 1,071
  • 2
  • 12
  • 26
RMcNeley
  • 1
  • 1

1 Answers1

0

I could recommend FileSaver.js. It's a really handy tool to download stuff, we're using it in our company in our ember application. https://github.com/eligrey/FileSaver.js/

Simply include it in your vendor folder and in the ember-cli-build.js

ember-cli-build.js

app.import('vendor/FileSaver.js');

Project Structure

/app
/build
.
.
.
/vendor
  FileSaver.js

Then you can call it from anywhere with

saveAs(new File([file], filename, additionalParameters))

and it will download the file.

For further documentation you can look at the github page.