Closed presencewebdesign closed 1 year ago
Hey @presencewebdesign,
The example I have provided works with fs
which is the file system handling import in Node.
To make it work on the frontend, you'll have to find a way to get the contents of the file and then pass that string to bookmarksToJSON
. I'm no Vue expert, so the one solution I can think of is making a fetch request to get the contents of the file if you know the path it's publicly available at, but there might be better ways to do this.
Also just want to note that just as readFileSync
does, writeFileSync
will also fail as you're in frontend code, but I imagine you don't actually want to write into a file somewhere, so I think it would be better for you to first change my example to the way you would actually want to work with the result, and see if you run into any issues (fingers crossed you don't).
Let me know if this was of any help
I keep getting this error
Error in v-on handler: "TypeError: fs.readFileSync is not a function"
<input @change="onFileChanged" type="file" />