UNPKG

661 BPlain TextView Raw
1import { Converter } from "./Converter";
2import P from "bluebird";
3import { JSONResult } from "./lineToJson";
4import { CSVParseParam } from "./Parameters";
5import { ParseRuntime } from "./ParseRuntime";
6
7export abstract class Processor {
8 protected params: CSVParseParam;
9 protected runtime: ParseRuntime;
10 constructor(protected converter: Converter) {
11 this.params = converter.parseParam;
12 this.runtime = converter.parseRuntime;
13 }
14 abstract process(chunk: Buffer,finalChunk?:boolean): P<ProcessLineResult[]>
15 abstract destroy():P<void>;
16 abstract flush(): P<ProcessLineResult[]>;
17}
18export type ProcessLineResult = string | string[] | JSONResult;