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

***

# Function: addFileToFlow()

> **addFileToFlow**(`directory`): (`id`, `file`, `version`?) => `Promise`<`void`>

Defined in: flows.ts:329

Adds a file to the given flow.

## 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                                           |
| ---------------- | ---------------------------------------------- |
| `id`             | `string`                                       |
| `file`           | { `content`: `string`; `fileName`: `string`; } |
| `file.content`   | `string`                                       |
| `file.fileName`? | `string`                                       |
| `version`?       | `string`                                       |

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

`Promise`<`void`>

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

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

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

// adds a file to the latest PaymentFlow flow
await addFileToFlow('PaymentFlow', { content: 'Hello world', fileName: 'notes.md' });

// adds a file to a specific version of the PaymentFlow flow
await addFileToFlow('PaymentFlow', { content: 'Hello world', fileName: 'notes.md' }, '0.0.1');
```
