+ 1

Creating and saving file in Javascript

How can a create and save a file(e.g txt) into the web users pc

6th Jun 2018, 2:27 PM
steve
steve - avatar
3 Answers
+ 7
steve You cant directly save it with javascript but you can force the user to download it. To create file you should take a look at ”Blob” thingy https://developer.mozilla.org/en-US/docs/Web/API/Blob Would be easier with server side.
6th Jun 2018, 3:54 PM
Toni Isotalo
Toni Isotalo - avatar
0
Browsers do not allow web scripts like JavaScript to store any files into local pc due to security reasons. You can only use local storage functions to store script variables in local pc.
6th Jun 2018, 2:35 PM
Calviղ
Calviղ - avatar
0
inspite of that how i create the file...maybe i ll just upload it to the sever
6th Jun 2018, 2:41 PM
steve
steve - avatar