Home > front end >  How to read file client-side without using a file input?
How to read file client-side without using a file input?

Time:03-07

I'm struggling to know how to read a file (client-side) in JS without using a file input, as I only need to read a local file in my project.

What I want to achieve is to get the content from a .less file in order to put it into a parser of some kind (I need to access its content in a javascript file).

I cannot use "fs" as I'm not using node, but I don't seem to be able to use the FileReader API either as it needs a Blob object which would be obtained by the file input.

Does someone have an idea ?

CodePudding user response:

client side doesn't have access to manage file system, you can read file with input but cannot write or delete from client side. it is only possible with a backend application written in node js or java, from their you can expose those services and call it from client side through http requests.

  • Related