Copy as Markdown[View as Markdown](/docs/sdk/functions/getChannels.md)

***

# Function: getChannels()

> **getChannels**(`directory`): (`options`?) => `Promise`<`Channel`\[]>

Defined in: channels.ts:52

Returns all channels from EventCatalog.

You can optionally specify if you want to get the latest version of the channels.

## Parameters[​](#parameters "Direct link to Parameters")

| Parameter   | Type     |
| ----------- | -------- |
| `directory` | `string` |

## Returns[​](#returns "Direct link to Returns")

`Function`

### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter             | Type                         |
| --------------------- | ---------------------------- |
| `options`?            | { `latestOnly`: `boolean`; } |
| `options.latestOnly`? | `boolean`                    |

### Returns[​](#returns-1 "Direct link to Returns")

`Promise`<`Channel`\[]>

## Example[​](#example "Direct link to Example")

```
import utils from '@eventcatalog/utils';

const { getChannels } = utils('/path/to/eventcatalog');

// Gets all channels (and versions) from the catalog
const channels = await getChannels();

// Gets all channels (only latest version) from the catalog
const channels = await getChannels({ latestOnly: true });
```
