Skip to main content
New project sponsor 🪝Hookdeck: Serverless infrastructure for event-driven architecture. Learn more.

addFileToEvent

Callable

  • addFileToEvent(directory: string): (id: string, file: { content: string; fileName: string }, version?: string) => Promise<void>

  • 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.

    @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');