I would like to know and what is possible to write JSON file which is in the same machine as my application using a vue program. To read a file I imported the json and it works well, on the other hand to write or modify I did not find how to do it.
My goal is to use the JSON as a database.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (4)
This StackOverflow question should help with the creation of a JSON file:
Some while ago I started learning Vue.js and a short while after, I started a bigger project, not keeping in mind, that Javascript has limited options to interact with the local file system I set up the project via vue-cli, so I have to start the website via
npm start
โฆHowever using a local file as a database is a little less clear of an answer depending on what you're trying to accomplish. If the user is creating their own local database for while they use the app, this would work (as long as the user only uses the app from that device).
But for a database that connects to other users you might want to look into Supabase or Firebase or CouchDb combined with PouchDb if you're interested in hosting the Database yourself :)
Hello, thank you for your answer. But in the proposals it gives it does not write to a file. I have a file and I need to inject my data from the program to my file
Yes the database I will use it only when the program is running
The Blob and Electron
fs
methods both will create a file - it's just a matter of saving the file to the location where your app is expecting it to be ๐Hello, thank you for your answer. But in the proposals it gives it does not write to a file. I have a file and I need to inject my data from the program to my file
Yes the database I will use it only when the program is running