简体   繁体   English

如何在 Electronjs 中的文件夹上添加事件侦听器

[英]How to add event listener on folder in Electronjs

我正在尝试检测文件夹中的更改,例如当我在指定文件夹中创建/更新某些内容时,我需要在我的电子应用程序的控制台中看到它,所以问题是如何在控制台中显示文件夹中的每个更改以及何时单击在任何文件上,如何检测我单击了哪个文件,是否可以使用electronjs/nodejs

this article compares the chokidar module with the node.js builtins fs.watch() and fs.watchFile() and comes to the conclusion that chokidar is the way to go. 本文chokidar模块与 node.js 内置的fs.watch()fs.watchFile()进行了比较,得出的结论是chokidar是要走的路。 So there's your alternatives for implementing this feature.因此,您可以有多种选择来实现此功能。

This does not handle clicking on files though (you mean in the file explorer, not in your app, right?) which is not possible afaik.这并不处理点击文件(你的意思是在文件浏览器中,而不是在你的应用程序中,对吧?)这是不可能的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM