2

I am having issues creating a "export" functionality for my application. There is a reason why I want to do this, and its pretty simple: When people are done doing what they are doing, and in my application it is calculations, people may want to save that data so they don't have to go back and do it again. Here is what I have now:

  methods: {
    createFile: function () {
      var data = `
      Test Data: ${this.chcCalc}`;
      var fso = CreateObject("Scripting.FileSystemObject");
      var s   = fso.CreateTextFile("filename.txt", True);

      s.writeline(data);
      s.Close();

    },
  }

I've been doing some research and it seems it MIGHT not be possible to do this and if so kind of a drag. I'm aware why the above doesn't work but it was the only example I could find.

William
  • 1,175
  • 2
  • 17
  • 32
  • With vuejs I didn't see, but maybe a simple JS code works https://stackoverflow.com/a/14966131/3256489 ? – 4givN Dec 21 '19 at 13:43

2 Answers2

4

I found the module: file-saver, so I am using that. If someone else has the same issue I have, and want it you can find the module here: https://www.npmjs.com/package/file-saver

William
  • 1,175
  • 2
  • 17
  • 32
0

For those who are using VUE3, file-saver does not work. But this does: https://www.telerik.com/kendo-vue-ui/components/filesaver/

import { saveAs, encodeBase64 } from '@progress/kendo-file-saver';

const dataURI = "data:text/plain;base64," + encodeBase64("Hello World!");
saveAs(dataURI, "test.txt");
Maka
  • 371
  • 3
  • 14