npm install rir-parser
These RIRs publish lists (called RIR statistics) showing which addresses have been assigned, and to which country they are assigned. These lists can be obtained from several locations, including the Number Resource Organization and via FTP from ARIN and RIPE.
This module parses those lists, consolidating adjacent IPv4 ranges and returning a minimal list of IP ranges (both IPv4 and IPv6) and the country to which the range is assigned.
This module exposes one class,
RirParser, which is a Node.js Transform stream.
To use it, create an instance of
RirParser and pipe the list to it. The
range: … kind: 'ipv4'|'ipv6' country: two-letter country code
var RirParser = ;var parser = ;parser;someIncomingRirDataFileStream;