J
J
jeruthadam2019-08-13 23:01:15
Node.js
jeruthadam, 2019-08-13 23:01:15

How to stream a change in a file in real time?

There is a file on the VPS, let for example access.log, to which nginx writes. How to broadcast changes in this realtime text file? There are no issues with the realtime part - through web sockets. But what is the right way to watch for changes in a file and send these changes line by line? A line was added - the message was sent, and so on.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Inviz Custos, 2019-08-14
@MvcBox

https://www.npmjs.com/package/tail
No thanks.

R
RidgeA, 2019-08-13
@RidgeA

https://nodejs.org/docs/latest/api/fs.html#fs_fs_w...
https://nodejs.org/docs/latest/api/fs.html#fs_fs_w...
https://www. npmjs.com/package/chokidar

A
Anton Filippov, 2018-01-06
@vicodin

it is not clear without the code, perhaps the margin at the top of the block with About me needs to be reset, it is possible that the margin at the bottom of the hero block should be reset

R
Ranwise, 2018-01-07
@Ranwise

perhaps the h1\h2 tag has an indent

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question