Abcdef GHI
Abcdef GHI

Reputation: 115

Modify a local file with Javascript

I must make a local app with an interface. This app should load text files, modify them, and save them.

I made the interface with html/css/js, and the core of the app was made with js only.

Currently, I load the file with an input, but to save it, the browser makes me download it. I know this is a security measure.

This app is not going to be put online.

My question is : what can I do to replace directly the loaded file by the new one ?

Thanks.

Upvotes: 2

Views: 3638

Answers (2)

Christoph Pader
Christoph Pader

Reputation: 168

JS in the browser is not able to edit local files, because of security.

If you want to, you can use Node.js, a Desktop/Server Framework, which uses JS.

Upvotes: 0

Roberto Russo
Roberto Russo

Reputation: 853

If you don't need your app to be online, with Electron you can make an executable using your existing code (you will have change how you're going to save the file using Electron APIs). Being a program running on your system, you'll be able to save directly on the file system.

Upvotes: 1

Related Questions