I'm currently using Javascript to create an application that allows the user to enter some information in a form and it will export some images and a JSON file to a destination on their computer. I've never done any programming that requires adding or editing folders and images on the user's local drive. I presume this is difficult with Javascript as there are sandbox violations - so I was wondering if someone could recommend a tool or process that would allow me to do this. I'm confident with Javascript, so if that's a possibility it would be brilliant. I would need to copy images from one destination, create a new folder and paste them in there.
2 Answers
For desktop applications you can use Electron or NW.js. It's only javascript, html and css.
NW: http://nwjs.io/
Electron: http://electron.atom.io/
Electron and nw use node.js and chromium in order to create cross OS desktop application, and since they are using nodeJS you can use tools like http://aheckmann.github.io/gm/ for resizing, modifying images.
For filesystem you can use nodeJS fs module: https://nodejs.org/api/fs.html
Or just use Child Process exec or spawn method to execute commands https://nodejs.org/api/child_process.html
There are tons of tools, you can do pretty much what you want, just take a look at this list: https://github.com/sindresorhus/awesome-nodejs

- 1,760
- 1
- 12
- 25
I'm not sure if you're referring to a local application running on a JavaScript engine, or whether you're writing a website.
For a website, if you have access to the images, you could simply serve them up to the client as a download (along with the JSON file).
<a href="http://mysite/images/theimage.jpg" download id="download" hidden></a>
Take a look at this answer for more examples.
However, if you need to fetch the data from the server's disk, you'll need a back-end server running your website, like ASP .NET MVC or node.js.

- 26,123
- 9
- 51
- 114

- 5,865
- 5
- 31
- 52
-
No idea why I hadn't thought of doing this - I had it stuck in my head to make the application local. I think I'm going to use a zip library to zip all of the content together and make it downloadable - thank you. – JCoulam Jul 27 '16 at 08:13