Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-tool-utils

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-tool-utils

node cross-platform tool library

  • 1.2.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
100
increased by11.11%
Maintainers
1
Weekly downloads
 
Created
Source

node-tool-utils

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Node Cross-Platform Tool Library

Featues

npm install node-tool-utils --save

Usage

const tool = require('node-tool-utils');

Get Local IP Address

const ip = tool.getIP();

Get Local Host

const host = tool.getHost(7001);
// http://100.10.196.1:7001

Kill the occupied port

tool.kill(7001);
tool.kill([7001,7002]);

Check port is available

// return true or false
const isUsed = tool.checkPortUsed(7001);

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.getPort(7001);

Delete File

const dir = path.join(__dirname, 'dist/index.html');
tool.deleteFile(dir);

Delete Dir

const dir = path.join(__dirname, 'dist');
tool.rm(dir);

Open Browser Or Window

Open the Window or Finder or Browser of the specified path

tool.open('.'); // open Window or Finder
tool.openBrowser(); // open Browser

Start Web Http Server

Default check HTML file as homepage

const dist = path.join(__dirname, 'dist');
tool.httpserver({ port: 8088, dist },() => {});

License

MIT

Keywords

FAQs

Package last updated on 22 Jan 2019

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