ip-to-base - Convert IP address to its binary/decimal/hexadecimal/octal representation and vise versa
# npm ..
$ npm install ip-to-base
# yarn ..
$ yarn add ip-to-base
This is a practical example of how to use.
import { IpToBase, BaseToIp } from 'ip-to-base'
// convert ip address to binary
const result = new IpToBase('127.0.0.1', 2).convert()
console.log(result)
// 01111111000000000000000000000001
// convert binary to ip address
const result = new IpToBase('01111111000000000000000000000001', 2).convert()
console.log(result)
// 127.0.0.1