# ipv6Pack() function · @imqueue/net

Source: https://imqueue.org/api/net/latest/net.ipv6pack/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/net 3.0.2 — generated reference, not hand-written

Compresses an IPv6 address: drops leading zeros from each group and collapses the longest run of zero groups to `::`.

**Signature:**

```typescript
export declare function ipv6Pack(ip: string): string;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| ip | string | a full or partly compressed IPv6 address |


**Returns:**

string

The compressed form, e.g. `2001:0db8:0000:0000:0000:0000:0000:0001` becomes `2001:db8::1`.

## Remarks

The inverse of [ipv6Unpack()](https://imqueue.org/api/net/latest/net.ipv6unpack/), and what this package emits when producing IPv6 text. It is a string transformation with no validation, so a malformed input produces malformed output rather than an error.

