I am trying to read files from my music directory on my PC. I have tried doing it with the node.js file system module, but it is not working. How do I get it to work?😢
-
3Vue is a frontend framework. You cant read filesystems with that. The backend should take care of that (like PHP/Node/C#/...). You can make such data available using an API which Vue can call using AJAX requests.Flame– Flame2020-04-06 12:42:39 +00:00Commented Apr 6, 2020 at 12:42
-
I don't have a backend for the appRukkiecodes– Rukkiecodes2020-04-06 12:54:55 +00:00Commented Apr 6, 2020 at 12:54
-
is there no library for this?Rukkiecodes– Rukkiecodes2020-04-06 12:55:16 +00:00Commented Apr 6, 2020 at 12:55
2 Answers
Just a late follow-up. It is possible to read and write files using HTML5 with the FileReader and saveAs(). The browser will open a file dialogue and let the user choose the file, so the user is aware of the file access. It is not possible to read or write to a file without the user's attention.
2 Comments
As said by @flame in a comment, it's just impossible, because the browser never have access to the visitor's disk (do you imagine the security issue if it was the case ?).
Vue.js is a Front-end framework, so the application it produces only have access to what the browser has access to.