1 | import { Converter } from "./Converter";
|
2 | import P from "bluebird";
|
3 | import { JSONResult } from "./lineToJson";
|
4 | import { CSVParseParam } from "./Parameters";
|
5 | import { ParseRuntime } from "./ParseRuntime";
|
6 |
|
7 | export 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 | }
|
18 | export type ProcessLineResult = string | string[] | JSONResult;
|