I'm doing some web scraping and am collecting data in a directory every 60 mins with .json files where the file names are unpredictable. I'd like to round up all those .json files and display them on a web page. Using fs, it would be easy as I could check which files in the directory have a .json extension and iterate over each one.However, this is for a web page and not a command-line script, so fs is off-limits. I also can't use fetch, require or any other client-side method of retrieving data from a .json file, since I can't guess what the file name will be.I'm using Express if there is anything useful with that. I've tried using express.static to serve the directory where the .json files are stored, but it's not really what I'd like. I'd like to have fs-like functionality in navigating and iterating. To concisely summarise my issue:I'd like to iterate over .json files on my server so I can take and display the data on the web page.I know where the .json files are stored but not what they will be called.Thanks in advance.
Submitted January 06, 2019 at 02:21PM by beefyjon
No comments:
Post a Comment