Scrolling log file (tail -f) animation using javascript

后端 未结 4 713
心在旅途
心在旅途 2020-12-28 10:33

I\'d like to create an animation on a website to mimic a scrolling log file or tail -f. I\'d feed it a list of fake log messages and they would be written to the bottom of t

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-28 10:57

    Here is a great solution

    This uses an ajax request, and the HTTP Range: header to request only the last ~30KB of a log file. It then polls for data appended to that file, and only ever retrieves new data (no refreshing the whole file, or even the last 30KB). Handles file truncation too.

    https://github.com/ukhas/js-logtail#readme

提交回复
热议问题