node-tool-utils
Node Cross-Platform Tool Library
Featues
npm install node-tool-utils --save
Usage
const tool = ;
Get Local IP Address
const ip = tool;
Get Local Host
const host = tool;// http://100.10.196.1:7001
Kill the occupied port
tool;tool;
Check port is available
// return true or falseconst isUsed = tool;
Get an available port
When 7001 is occupied, it will automatically detect whether 7002 is occupied. If it is not occupied, it will return. Otherwise, it will continue to increment detection. The default check is 10 times.
const port = tool;
Delete File
const dir = path;tool;
Delete Dir
const dir = path;tool;
Open Browser Or Window
Open the Window or Finder or Browser of the specified path
tool; // open Window or Findertool; // open Browser
Start Web Http Server
Default check HTML file as homepage
const dist = path;tool;