mardi 27 février 2018

How to create offline web app with JavaScript that can read local file and parse?

I'm trying to create an app with a browser interface that allows users to input a text file and then parse it for certain phrases. I have all the logic/regex I need to do the parsing, I just don't know how to implement it into a webpage interface.

What I currently have uses node.js and only works when I run the command with node (not in the browser) and hardcode the path to the file on my local system.

const fs = require("fs");
const text = fs.readFileSync("C:\\Users\\bob\\Desktop\\test\\sample.txt", "utf-8"); 
const textByLine = text.split("\n"); 

//rest of script logic below

I've been researching things like require.js and browserify which from what I understand, allow you to use node.js on client side, but I'm not sure if this is what I need.

I sort of want to make an electron app, but I'd rather build it out as a webapp first.

Is this the best way to go about accomplishing what I'm trying to do?




Aucun commentaire:

Enregistrer un commentaire