使用ajax / javascript / jquery文件wachting系统 [英] File wachting system with ajax/javascript/jquery

查看:156
本文介绍了使用ajax / javascript / jquery文件wachting系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,

我正在我的小应用程序中读出一个.txt文件。此文件现在更新,我希望每次更改此文件时都重新加载页面。这甚至可能吗?我考虑过编写一个函数来检查文件是否每次更新,但我怎么能知道它确实已更新?



有什么建议吗?

Hey guys,
i am reading out a .txt file in my little application. This file is updated then and now and i want the page to reload everytime this files was changed. Is this even possible? I considered writing a function which checks every second if the file was updated, but how can I figure out that it really was updated?

Any suggestions?

推荐答案

我不确定这可以做到,但是一点点的研究让我得到了一篇关于Node.js使用的文章(和代码库)功能。



使用Node.js监视文件夹中的文件和文件夹的更改 [ ^ ]



看一看DirectoryWatcher fileChanged事件,我认为它正是您正在寻找的。我没有测试过这个,所以请告诉我这是怎么回事。
I wasn't sure that this could be done, but a little research led me to an article (and codebase) on the use of Node.js that would allow for exactly this functionality.

Monitoring a Folder for Changes in Files and Folders with Node.js[^]

Take a look at the DirectoryWatcher fileChanged event, I think it is exactly what you're looking for. I haven't tested this, so please let me know how this works out for you.


这篇关于使用ajax / javascript / jquery文件wachting系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆