Nitul
Nitul

Reputation: 1035

Node JS - listen for system events

As per below API doc, Node JS listen for process exit event. https://nodejs.org/api/process.html#process_event_exit

How can Node JS listen for system event? Such as, USB inserted, CAMERA device inserted into system or any custom events emitted by Linux.

Upvotes: 4

Views: 1759

Answers (1)

Rui Sebastião
Rui Sebastião

Reputation: 883

Since in Linux "Everything is a file" you can monitor the /dev directory for changes. I use this nodejs inotify binding:

node-inotify - http://c4milo.github.io/node-inotify/

Upvotes: 1

Related Questions