简体   繁体   中英

How to keep track of a updating csv file in nodejs

I'm using websockets in NodeJS to create a server and I want to read a CSV file or parse a CSV file and print data on a web page but that file is updated frequently so is there a way to keep track of the updating file and print the updated data like appending the print data whenever updated?

I am able to parse csv and print data but want to keep track of updation

Have a look at using fs to watch a file for changes .

When this event fires for your file, you can send a socket event with the latest version of the contents of the file to the client. You will need to re-fill your file stream when this event fires, and then send the results over the socket.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM