beaugunderson/ip-address

ipAddress.fromBigInteger() not returning the correct address

tejpartapg opened this issue · 1 comments

Hello @beaugunderson ,

Please see attached screenshot of the test code on npm Runkit. I am trying to convert an IPv4 address to big integer through the method provided in documentation and then converting the big integer value back to IPv4 address. The first octet is not correct but rest of the address is converted correctly. Could you please confirm if this issue is not present in the actual code? I would like to make use of this library in my project. Also I noticed from the documentation that there is no method to convert to an IPv4 from binary. Would you happen to know a workaround on how to go about accomplishing that?
IP-Address-npm

Thank you

@tejpartapg sorry for the delayed reply--there is no need to index into the returned bigInt object; you need to pass in the whole thing.

e.g., this will have the desired effect:

ipAddress.fromBigInteger(bigInt);