How can I monitor a file asynchronously in Firefox?

£可爱£侵袭症+ 提交于 2019-12-04 15:34:54

There is no built-in API to get notified about file changes. However, you could use js-ctypes to call OS functions directly. So on Windows you would create a ChromeWorker and call FindFirstChangeNotification function there. You would then use a loop with the following calls:

And you should call FindCloseChangeNotification once you are done watching.

I may be wrong, but I'm fairly certain this can't be done without some sort of polling approach (ie: check the file over some interval or just before you are about to use it).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!