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

Method appendBuf

src/ProcessFork.ts:101–124  ·  view source on GitHub ↗
(data: string)

Source from the content-addressed store, hash-verified

99 this.resultBuf = [];
100 }
101 private appendBuf(data: string) {
102 const res = this.leftChunk + data;
103 const list = res.split("\n");
104 let counter = 0;
105 const lastBit = list[list.length - 1];
106 if (lastBit !== "") {
107 this.leftChunk = list.pop() || "";
108 } else {
109 this.leftChunk = "";
110 }
111 this.resultBuf=this.resultBuf.concat(list);
112 // while (list.length) {
113 // let item = list.shift() || "";
114 // if (item.length === 0 ) {
115 // continue;
116 // }
117 // // if (this.params.output !== "line") {
118 // // item = JSON.parse(item);
119 // // }
120 // this.resultBuf.push(item);
121 // counter++;
122 // }
123 // console.log("buf length",this.resultBuf.length);
124 }
125
126 process(chunk: Buffer): Promise<ProcessLineResult[]> {
127 return new Promise((resolve, reject) => {

Callers 2

initWorkerMethod · 0.95
ProcessFork.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected