Skip to main content

addFileToDataStore

Callable

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

  • Add a file to a data store (e.g. database, cache, etc.) by it's id.

    Optionally specify a version to add a file to a specific version of the data store.

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

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

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

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