Skip to content
/ inet Public

converts quad-dot-based IPv4 network address to their integer representation

License

Notifications You must be signed in to change notification settings

valmy/inet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

inet

Install with:

$ npm install inet

Sample usage script:

var inet = require("inet");

console.log(inet.aton("125.121.234.1"));
console.log(inet.ntoa(2107846951));

API Documentation

aton(str)

Given the dotted-quad representation of an IPv4 network address as a string, returns an integer that represents the numeric value of the address in network byte order (big endian). aton() returns null if it does not understand its argument. For IP Address of 'a.b.c.d', the numerical representation would be: a * 256^3 + b * 256^2 + c * 256 + d.

ntoa(int)

Given a numeric IPv4 network address in network byte order, returns the dotted-quad representation of the address as a binary string. ntoa() returns null if it does not understand its argument.

Tests

    $ npm install should
    $ npm install mocha
    $ npm test

Build Status

About

converts quad-dot-based IPv4 network address to their integer representation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published