@flatfile/util-extractor
Version:
A library containing common utilities and helpers for extractors.
26 lines (23 loc) • 909 B
text/typescript
import { Flatfile } from '@flatfile/api';
import { FlatfileListener } from '@flatfile/listener';
declare const Extractor: (fileExt: string | RegExp, extractorType: string, parseBuffer: (buffer: Buffer, options: any) => WorkbookCapture | Promise<WorkbookCapture>, options?: Record<string, any>) => (listener: FlatfileListener) => void;
declare function keysToFields({ keys, descriptions, }: {
keys: string[];
descriptions?: Record<string, string>;
}): Flatfile.Property[];
/**
* Generic structure for capturing a workbook
*/
type WorkbookCapture = Record<string, SheetCapture>;
/**
* Generic structure for capturing a sheet
*/
type SheetCapture = {
headers: string[];
descriptions?: Record<string, null | string> | null;
data: Flatfile.RecordData[];
metadata?: {
rowHeaders: number[];
};
};
export { Extractor, type SheetCapture, type WorkbookCapture, keysToFields };