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

Function prepareData

src/dataClean.ts:22–31  ·  view source on GitHub ↗
(chunk: Buffer, runtime: ParseRuntime)

Source from the content-addressed store, hash-verified

20 * 3. stripBom
21 */
22export function prepareData(chunk: Buffer, runtime: ParseRuntime): string {
23 const workChunk = concatLeftChunk(chunk, runtime);
24 runtime.csvLineBuffer = undefined;
25 const cleanCSVString = cleanUtf8Split(workChunk, runtime).toString("utf8");
26 if (runtime.started === false) {
27 return stripBom(cleanCSVString);
28 } else {
29 return cleanCSVString;
30 }
31}
32/**
33 * append data to buffer that is left form last chunk
34 */

Callers 1

processMethod · 0.90

Calls 3

concatLeftChunkFunction · 0.70
cleanUtf8SplitFunction · 0.70
stripBomFunction · 0.70

Tested by

no test coverage detected