# TokenBucketOptions

Defined in: [packages/rate-limit/src/rate-limit.ts:153](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/rate-limit/src/rate-limit.ts#L153)

The options a `token-bucket` accepts: [RateLimiterOptions](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/) plus the weight it regains.

## Extends

* [`RateLimiterOptions`](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/)

## Properties

### capacity

> `readonly` **capacity**: `number`

Defined in: [packages/rate-limit/src/rate-limit.ts:142](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/rate-limit/src/rate-limit.ts#L142)

The most weight one instant can admit from a fresh state. A positive safe integer.

#### Inherited from

[`RateLimiterOptions`](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/).[`capacity`](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/#capacity)

***

### windowDuration

> `readonly` **windowDuration**: `number`

Defined in: [packages/rate-limit/src/rate-limit.ts:147](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/rate-limit/src/rate-limit.ts#L147)

The width of the kind’s trailing window, in the milliseconds of [clock](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/#clock). A positive safe integer.

#### Inherited from

[`RateLimiterOptions`](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/).[`windowDuration`](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/#windowduration)

***

### clock

> `readonly` **clock**: [`Clock`](/reference/knotkit/cache/type-aliases/clock/)

Defined in: [packages/rate-limit/src/rate-limit.ts:149](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/rate-limit/src/rate-limit.ts#L149)

The time source the meter reads through, injected so a test replays every decision.

#### Inherited from

[`RateLimiterOptions`](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/).[`clock`](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/#clock)

***

### refillAmount

> `readonly` **refillAmount**: `number`

Defined in: [packages/rate-limit/src/rate-limit.ts:159](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/rate-limit/src/rate-limit.ts#L159)

The weight the bucket regains over one [RateLimiterOptions.windowDuration](/reference/knotkit/rate-limit/interfaces/ratelimiteroptions/#windowduration). A positive safe integer; a steady trickle of requests settles at one `refillAmount` per window.
