Get a File Stream of a Data Table

Get a stream of the contents of an exported data table, in CSV (default) or Excel format.

πŸ‘

Permissions Required

You must have View permissions to the field this file was uploaded to for this request to succeed

Method Signature

getDownloadStream(id: string, format: DataTableExportFormat): Promise<Stream>;
getDownloadStream(id: string, format: DataTableExportFormat, callback: ClientMethodCallback<Stream>): void;

Parameters

ParameterTypeDescription
idstringThe id of the Data Table to get a readable stream of
formatstringCSV or XLSX (Excel)
callback(err?: Error, stream: Stream) => anyOptional The callback
returnsStreamThe requested file's metadata and readable stream

Example

/*
 * This example demonstrates writing a Data Table's contents to
 * the Console as CSV rows
 */
const { CatalyticClient } = require('@catalytic/sdk');

const catalytic = new CatalyticClient();

const id = 'c9f2beec-10c0-4f2f-b4e0-1d884c7e053c';
const stream = await catalytic.dataTables.getDownloadStream(id, 'CSV');

stream.on('data', chunk => console.log(chunk.toString()));