[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [local‑first/Protocol](https://evolu.dev/docs/api-reference/common/local-first/Protocol) › encodeNonNegativeInt

```ts
function encodeNonNegativeInt(
  buffer: Buffer,
  int: number &
    Brand<"NonNaN"> &
    Brand<"Finite"> &
    Brand<"Int"> &
    Brand<"NonNegative">,
): void;
```

Defined in: [packages/common/src/local-first/Protocol.ts:1980](https://github.com/evoluhq/evolu/blob/037c390af081e9944d616ff298a729515c5c5ab7/packages/common/src/local-first/Protocol.ts#L1980)

Encodes a non-negative integer into a variable-length integer format. It's
more efficient than encoding via [encodeNumber](https://evolu.dev/docs/api-reference/common/local-first/Protocol/functions/encodeNumber).

https://en.wikipedia.org/wiki/Variable-length_quantity