---
url: https://docs.moqtail.dev/ts/api/model/classes/Location.md
---
# Class: Location

Represents a position in a MOQT track, consisting of a group and object index.

Used for specifying start/end positions in subscription and fetch requests.

* `group`: The group index (e.g. segment, GOP, or logical group).
* `object`: The object index within the group (e.g. frame, chunk).

## Constructors

### Constructor

> **new Location**(`group`, `object`): `Location`

Constructs a new Location.

#### Parameters

##### group

`number` | `bigint`

The group index (number or bigint).

##### object

`number` | `bigint`

The object index (number or bigint).

#### Returns

`Location`

## Properties

### group

> `readonly` **group**: `bigint`

The group index for this location.

***

### object

> `readonly` **object**: `bigint`

The object index within the group for this location.

## Methods

### compare()

> **compare**(`other`): `number`

Compares this Location to another for ordering.

#### Parameters

##### other

`Location`

The other Location to compare.

#### Returns

`number`

-1 if this < other, 1 if this > other, 0 if equal.

***

### equals()

> **equals**(`other`): `boolean`

Checks if this Location is equal to another.

#### Parameters

##### other

`Location`

The other Location to compare.

#### Returns

`boolean`

True if both group and object are equal.

***

### serialize()

> **serialize**(): [`FrozenByteBuffer`](FrozenByteBuffer.md)

Serializes this Location to a FrozenByteBuffer.

#### Returns

[`FrozenByteBuffer`](FrozenByteBuffer.md)

The serialized buffer.

#### Throws

CastingError if group or object is negative.

#### Throws

VarIntOverflowError if group or object exceeds varint encoding limits.

***

### deserialize()

> `static` **deserialize**(`buf`): `Location`

Deserializes a Location from a buffer.

#### Parameters

##### buf

[`BaseByteBuffer`](BaseByteBuffer.md)

The buffer to read from.

#### Returns

`Location`

The deserialized Location.

#### Throws

NotEnoughBytesError if buffer does not contain enough bytes.
