ip
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The "ip" npm package provides utilities for handling IP addresses in Node.js. It allows users to perform operations like getting an IP address, comparing IP addresses, validating IP addresses, as well as advanced operations like IP masking, subnet information extraction, and IP range checking.
To use the "ip" npm package, first, install it using your npm package manager with the command npm install ip
or clone it from its GitHub repository with git clone https://github.com/indutny/node-ip.git
.
Then, require the package in your JavaScript file using the require()
function and access its methods as shown below:
var ip = require('ip');
console.log(ip.address()); // displays your ip address
console.log(ip.isEqual('::1', '::0:1')); // compares IP addresses, returns true
console.log(ip.toBuffer('127.0.0.1')); // converts IP address to buffer
console.log(ip.isPrivate('127.0.0.1')); // checks if IP address is private, returns true
//...additional features...
The documentation for the "ip" package is available in the README file in its source code repository on GitHub. This README contains a comprehensive guide on installing and using the package, with examples of all its utility functions.