In our database, IP address is stored as Binary(16), and it is a ipv6 On the client side I'm getting it as string, which is a hybrid of octal codes and printable ASCII characters. A byte in the range of printable ASCII characters (the range [0x20, 0x7e]) is represented by the corresponding ASCII character, with the exception of the backslash ('\'), which is escaped as '\'. All other byte values are represented by their corresponding octal values. For example, the bytes {97,92,98,99}, which in ASCII are {a,\,b,c}, are translated to text as 'a\bc'.
" \001\015\270\000\000\000\000\000\010\010\000\014Az\000"
The problem is I would like to show it like a human readable IPv6. I tried some libraries but they require a byte arrays as an input.
I think I can solve my problem by converting the hybrid octal to a byte array and then use https://www.npmjs.com/package/ipaddr.js to convert to IPv6.
The string above translate to byte array in decimal values as: [32, 1, 13, 184, 0, 0, 0, 0, 0, 8, 8, 0, 12, 65, 122, 0] the blank space is 32 ascii, A=65 and z=122
Im working in a function to parse the hybrid octal to byte array. I will share when ready.