ip-string-to-number
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

ip-string-to-number · npm

Simple helper functions for converting IP addresses from human-readable string to integers. IPv6 support included!

Usage

IPv4

const { ipV4StringToNumber } = require('ip-string-to-number');

ipV4StringToNumber('8.8.8.8'); // 134744072

IPv6

Result will be always bigint, as IPv6 address value can overcome MAX_SAFE_INTEGER in JS.

const { ipV6StringToNumber } = require('ip-string-to-number');

ipV6StringToNumber('::1'); // 1n

Readme

Keywords

Package Sidebar

Install

npm i ip-string-to-number

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

5.28 kB

Total Files

11

Last publish

Collaborators

  • dkonasov