Skip to content

fromBinary()

Evgheniy Kovaliov edited this page May 10, 2023 · 1 revision

fromBinary(binaryIp)

Description

Method that allows you convert binary ip address to common form.
Entered binary ip address must be correct. (see validation)

Contract

Parameters:

  • binaryIp: string — binary form of ip address.

Return:

  • ip: string
Exceptions

Invalide binary ip entered!:

  • entered argument is not a correct binary ip address.
Usage
ipv4.fromBinary('01111011.01111011.01111011.01111011');   // '123.123.123.123'
ipv4.fromBinary('00000000.00000000.00000000.00000000');   // '0.0.0.0'
ipv4.fromBinary('11111111.11111111.11111111.11111111');   // '255.255.255.255'
ipv4.fromBinary('00001010.00000000.00000000.00000001');   // '10.0.0.1'
ipv4.fromBinary('11000100.10000000.01000000.00000000');   // '196.128.64.0'
ipv4.fromBinary('10000000.00000000.00000000.00000000');   // '128.0.0.0'

ipv4.fromBinary('01100100.11001000.01100100.01000102');   // Error: Invalide binary ip entered!
ipv4.fromBinary('01100100.11001000.01100100.01000101.0'); // Error: Invalide binary ip entered!
ipv4.fromBinary('10101110.01001000.10110110.one111111');  // Error: Invalide binary ip entered!
ipv4.fromBinary('0.0.0.0');                               // Error: Invalide binary ip entered!
  • Is used in other methods.

MAIN PAGE

See all methods documentation:

For ip version 4

For ip version 6

Clone this wiki locally