1

I have a Dart [client side only, polymer] web-app. So I cannot use dart.io. I would like to do this semi-pseudo (language/platform mix!) code:

  ..
  String str = "a load of text";
  File file = new File('C:\\folder\\test.txt');
  file.write(str);
  file.close();

or

  window.clipboard.copy(str);

so the user can paste it. I have used a TextAreaElement to put the string on (using textarea.value=str), and then the user can copy and paste it himself, but that's a bit naff.
Thanks
Steve

Lymp
  • 933
  • 1
  • 7
  • 20
  • 1
    Look here: https://stackoverflow.com/questions/2897619/using-html5-javascript-to-generate-and-save-a-file/32295448 – jobukkit Sep 27 '16 at 21:48

1 Answers1

2

Sorry, you cannot write to files on the file system from a web app. The restriction is from browsers and their security model.

Seth Ladd
  • 112,095
  • 66
  • 196
  • 279
  • Thanks. I thought that was the case, but stackedit and other web apps export to local disk. I see httprequest (haven't used it). It looks like I need to use that, but I'd prefer an automatic copy to the clipboard. Still learning....!
    Cheers, S
    – Lymp Apr 17 '15 at 09:04