MCPcopy Create free account
hub / github.com/Inist-CNRS/node-csv-string / _transform

Method _transform

src/Streamer.ts:25–45  ·  view source on GitHub ↗
(chunk: any, _encoding: string, callback: TransformCallback)

Source from the content-addressed store, hash-verified

23 // overridden function with same signature
24 // eslint-disable-next-line @typescript-eslint/no-explicit-any
25 _transform(chunk: any, _encoding: string, callback: TransformCallback): void {
26 this.buffer = this.buffer.concat(chunk.toString());
27 if (this.sep === undefined) {
28 // try to detect the separator if not provided
29 this.sep = detect(this.buffer);
30 }
31
32 const csv = new Parser(this.buffer, this.sep, this.quo);
33 const rows = csv.File();
34
35 if (csv.linePointer !== csv.pointer) {
36 rows.pop();
37 }
38 this.buffer = this.buffer.slice(csv.linePointer);
39 if (rows.length > 0) {
40 rows.forEach((row) => {
41 this.push(row);
42 });
43 }
44 callback();
45 }
46
47 // TODO
48 /*

Callers

nothing calls this directly

Calls 2

FileMethod · 0.95
detectFunction · 0.90

Tested by

no test coverage detected