aero-win-usb-detection
Version:
Listen to USB devices for attach/detach and get drive path and label (Windows only)
31 lines (20 loc) • 579 B
Markdown
`aero-win-usb-detection` allows you to listen for attach/detach events of USB devices and get device path and label.
```sh
npm i aero-win-usb-detection
```
```js
import UsbEventsContorller from "aero-win-usb-detection";
var usbController = new UsbEventsContorller();
usbController.startListening();
usbController.on("attach", (device) => {
console.log(device);
});
usbController.on("detach", (device) => {
console.log(device);
});
// To stop listening
// usbController.stopListening();
```