通过chunk-node.js实时读取数据块?

时间:2013-06-12 06:33:51

标签: node.js file file-io

我正在开展网络分析。为了报告流量和用户信息,我想read the flat file at real-time,平面文件由extended log format中的用户信息组成。

要求

Reading the flat files at real-time which means, reading the particular chunk of data from the file and listening to the file for update if it is updated (new line or data added in the file) read the updated data and serve it for reporting.

类似

此技术类似于unix系统中的tail -f

已知

node.js中的

File reading

任何类似于此要求的技术?

1 个答案:

答案 0 :(得分:1)

有一个tail module,其内部使用fs.watchFilefs.createReadStream

在启动时你只需“扔掉”你不需要的每一行。总而言之,最简单的方法就是......