ip-to-base
v0.0.1
Published
Convert IP address to its binary/decimal/hexadecimal/octal representation and vise versa
Downloads
11
Maintainers
Readme
ip-to-base - Convert IP address to its binary/decimal/hexadecimal/octal representation and vise versa
Installation
# npm ..
$ npm install ip-to-base
# yarn ..
$ yarn add ip-to-base
Usage
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