Constructor
new InetAddress(buffer)
Creates a new instance of InetAddress
Parameters:
Name | Type | Description |
---|---|---|
buffer |
Buffer |
Members
length :Number
Returns the length of the underlying buffer
Type:
- Number
version :Number
Returns the Ip version (4 or 6)
Type:
- Number
Methods
(static) fromString(value)
Parses the string representation and returns an Ip address
Parameters:
Name | Type | Description |
---|---|---|
value |
String |
equals(other) → {Boolean}
Compares 2 addresses and returns true if the underlying bytes are the same
Parameters:
Name | Type | Description |
---|---|---|
other |
InetAddress |
Returns:
- Type
- Boolean
getBuffer() → {Buffer}
Returns the underlying buffer
Returns:
- Type
- Buffer
inspect() → {string}
Provide the name of the constructor and the string representation
Returns:
- Type
- string
toJSON()
Returns the string representation.
Method used by the native JSON.stringify() to serialize this instance.
toString() → {String}
Returns the string representation of the IP address.
For v4 IP addresses, a string in the form of d.d.d.d is returned.
For v6 IP addresses, a string in the form of x:x:x:x:x:x:x:x is returned, where the 'x's are the hexadecimal values of the eight 16-bit pieces of the address, according to rfc5952. In cases where there is more than one field of only zeros, it can be shortened. For example, 2001:0db8:0:0:0:1:0:1 will be expressed as 2001:0db8::1:0:1.
Returns:
- Type
- String