1

I need to write a string to a file in a specific project folder.
I receive this string from server, and I need to write it to local file, specifying the folder, and replace the file each time I write the string.
I've tried using angular file-saver, but the browser asks for user interaction. Also, I can't specify the location where to save it.
Is there a way to achieve this?

User978438
  • 149
  • 1
  • 3
  • 13

2 Answers2

0

All browsers are set in a manner to require user interaction for that sort of activity. If there was no protection of this kind, you would be able to save any file without users consent.

So the actual file saving (prompting to save file) needs to happen in a callback of some interaction (ex. click)

Mario Petrovic
  • 7,500
  • 14
  • 42
  • 62
0

Actually you can not access file system using browser without user interaction :)

Think about it if it was possible anyone would be able to read ur file system by creating a website.

but u can still save ur string in localStorage it can save upto 5mb try it will serve ur needs. if not please ask more questions

hanan
  • 1,768
  • 1
  • 14
  • 19