Skip to main content

Function: addFileToCommand()

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

Defined in: commands.ts:253

Add a file to a command by it's id.

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

Parameters

ParameterType
directorystring

Returns

Function

Parameters

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

Returns

Promise<void>

Example

import utils from '@eventcatalog/utils';

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

// adds a file to the latest UpdateInventory command
await addFileToCommand('UpdateInventory', { content: 'Hello world', fileName: 'hello.txt' });

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