New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

changedrive-cli

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

changedrive-cli

change drive USB

  • 2.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

changedrive-cli (USB U盘变化监听 命令行软件)

支持的平台(Supported platforms) :win(Support) mac(preparation) linux(preparation)
使用的编程语言(Programming languages used) : rust typescript

如何使用(Operation method)

// require
let changeDrive = require("changedrive-cli").default;
let {changeDrive} = require("changedrive-cli");

// ejs 
import changeDrive from "changedrive-cli";
import {changeDrive} from "changedrive-cli";

// typescript 
import changeDrive = require("changedrive-cli").default;
import {changeDrive} = require("changedrive-cli");
import changeDrive from "changedrive-cli";
import {changeDrive} from "changedrive-cli";



changeDrive.changeDrive(function(Type,name,id,DriveContent){
	//做点什么事(Do something)
    console.log(Type,name,id,DriveContent);
     // start USB#VI... 60A...2F2 {event: 'start'... product_id: 49284...}
     // add USB#VI... 60A4....7402F2 {event: 'add'... product_id: 49284...}
});

changeDrive.on("add",console.log)
// USB#VID_0951&PID_1665#****fb951ed} 60A4****402F2 {event:...}

changeDrive.on("remove",console.log)
// USB#VID_0951&PID_1665#****fb951ed} 60A4****402F2 {event:...}

// 设置一个系列号(id)的解析方法
changeDrive.SetMatchIdFun(name=>{
    return (name||"") + "{:123456789:}";
})

// 系列号将变成:(id format redirect)
// 0501aa8fa{:123456789:}

//销毁监听并GC掉绑定(Destroy the listener and unbind it)
changeDrive.stop();

/// log =>exit null null

/**
 * @zh 枚举所有当前存在的驱动器(实时)
 * @en Enumerate all drives(Real-time)
 * @time 50.3291015625 ms
 */
changeDrive.forEach((id,DriveContent,index)=>{
    console.log(id,DriveContent,index);
    // 00E04...101 USB\...101 {event: 'add'... product_id: 49284...} 0
})

changeDrive.getDriveList 
// {event: 'forEach',description: 'Realtek',id: '00E04' ....}[]



Keywords

FAQs

Package last updated on 03 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc