Skip to main content

Function: addFileToEvent()

addFileToEvent(directory): (id, file, version?, options?) => Promise<void>

Defined in: events.ts:252

Add a file to an event by it's id.

Optionally specify a version to add a file to a specific version of the event.

Parameters​

ParameterType
directorystring

Returns​

Function

Parameters​

ParameterType
idstring
file{ content: string; fileName: string; }
file.contentstring
file.fileName?string
version?string
options?{ path: string; }
options.path?string

Returns​

Promise<void>

Example​

import utils from '@eventcatalog/utils';

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

// adds a file to the latest InventoryAdjusted event
await addFileToEvent('InventoryAdjusted', { content: 'Hello world', fileName: 'hello.txt' });

// adds a file to a specific version of the InventoryAdjusted event
await addFileToEvent('InventoryAdjusted', { content: 'Hello world', fileName: 'hello.txt' }, '0.0.1');