Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@leichtgewicht/ip-codec

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@leichtgewicht/ip-codec

Small package to encode or decode IP addresses from buffers to strings.

  • 2.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.6M
decreased by-6.61%
Maintainers
1
Weekly downloads
 
Created

What is @leichtgewicht/ip-codec?

The @leichtgewicht/ip-codec package is designed for encoding and decoding IP addresses. It supports both IPv4 and IPv6 formats, providing a straightforward way to handle IP address transformations in Node.js applications. This package can be particularly useful for applications that need to store or transmit IP addresses in a compact format, perform IP address manipulations, or validate IP address formats.

What are @leichtgewicht/ip-codec's main functionalities?

Encoding an IPv4 address

This feature allows you to encode an IPv4 address into a compact, easily storable or transmittable format.

"const ipCodec = require('@leichtgewicht/ip-codec');\nconst encoded = ipCodec.encode('192.168.1.1');\nconsole.log(encoded); // Outputs the encoded IP address"

Decoding an IPv4 address

This feature enables the decoding of an encoded IPv4 address back to its standard dot notation.

"const ipCodec = require('@leichtgewicht/ip-codec');\nconst decoded = ipCodec.decode('c0a80101');\nconsole.log(decoded); // Outputs '192.168.1.1'"

Encoding and decoding IPv6 addresses

Support for IPv6 addresses, allowing them to be encoded and decoded just like IPv4 addresses, facilitating operations on modern IP addresses.

"const ipCodec = require('@leichtgewicht/ip-codec');\nconst encodedIPv6 = ipCodec.encode('2001:0db8:85a3:0000:0000:8a2e:0370:7334');\nconst decodedIPv6 = ipCodec.decode(encodedIPv6);\nconsole.log(decodedIPv6); // Outputs the original IPv6 address"

Other packages similar to @leichtgewicht/ip-codec

Keywords

FAQs

Package last updated on 27 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc