prips.js
v1.0.0
Published
Prints IP subnet ranges by list or CIDR
Downloads
2
Readme
prips.js
Prints IP subnet ranges by list or CIDR
Installation
npm install prips.js
Usage
const prips = require('prips');
prips('192.168.0.0/30');
// => [ '192.168.0.0', '192.168.0.1', '192.168.0.2', '192.168.0.3' ]
prips('192.168.0.0/255.255.255.252', { format: 'hex' });
// => [ '0xC0A80000', '0xC0A80001', '0xC0A80002', '0xC0A80003' ]
prips('192.168.0.0 255.255.255.252', { format: 'dec' });
// => [ 3232235520, 3232235521, 3232235522, 3232235523 ]
prips('192.168.0.0', '192.168.0.3', { increment: 2 });
// => [ '192.168.0.0', '192.168.0.2' ]
Options
format
- dec | dot | hex (default dot)increment
- positive integer (default 1)
CLI
$ prips.js -h
// => usage: prips.js [options] <start end | CIDR block>
// => -h display this help message and exit
// => -f <x> set the format of addresses (hex, dec, or dot)
// => -i <x> set the increment to `x`
License
MIT