Skip to main content

Function: addFileToDataProduct()

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

Defined in: data-products.ts:263

Add a file to a data product by its id.

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

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 { addFileToDataProduct } = utils('/path/to/eventcatalog');

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

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