MCPcopy Create free account
hub / github.com/Keyang/node-csvtojson / flush

Method flush

src/ProcessorLocal.ts:14–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13export class ProcessorLocal extends Processor {
14 flush(): Promise<ProcessLineResult[]> {
15 if (this.runtime.csvLineBuffer && this.runtime.csvLineBuffer.length > 0) {
16 const buf = this.runtime.csvLineBuffer;
17 this.runtime.csvLineBuffer = undefined;
18 return this.process(buf, true)
19 .then((res) => {
20 if (this.runtime.csvLineBuffer && this.runtime.csvLineBuffer.length > 0) {
21 return Promise.reject(CSVError.unclosed_quote(this.runtime.parsedLineNumber, this.runtime.csvLineBuffer.toString()))
22 } else {
23 return Promise.resolve(res);
24 }
25 })
26 } else {
27 return Promise.resolve([]);
28 }
29 }
30 destroy(): Promise<void> {
31 return Promise.resolve();
32 }

Callers

nothing calls this directly

Calls 3

processMethod · 0.95
thenMethod · 0.80
unclosed_quoteMethod · 0.80

Tested by

no test coverage detected