(chunk: Buffer, finalChunk = false)
| 49 | |
| 50 | } |
| 51 | process(chunk: Buffer, finalChunk = false): Promise<ProcessLineResult[]> { |
| 52 | let csvString: string; |
| 53 | if (finalChunk) { |
| 54 | csvString = chunk.toString(); |
| 55 | } else { |
| 56 | csvString = prepareData(chunk, this.converter.parseRuntime); |
| 57 | |
| 58 | } |
| 59 | return Promise.resolve() |
| 60 | .then(() => { |
| 61 | if (this.runtime.preRawDataHook) { |
| 62 | return this.runtime.preRawDataHook(csvString); |
| 63 | } else { |
| 64 | return csvString; |
| 65 | } |
| 66 | }) |
| 67 | .then((csv) => { |
| 68 | if (csv && csv.length > 0) { |
| 69 | return this.processCSV(csv, finalChunk); |
| 70 | } else { |
| 71 | return Promise.resolve([]); |
| 72 | } |
| 73 | }) |
| 74 | } |
| 75 | private processCSV(csv: string, finalChunk: boolean): Promise<ProcessLineResult[]> { |
| 76 | const params = this.params; |
| 77 | const runtime = this.runtime; |
no test coverage detected