A transform stream that converts a stream of tokens into a stream of rows.
new ReadableStream({ start(controller) { controller.enqueue("name,age\r\n"); controller.enqueue("Alice,20\r\n"); controller.close(); }}) .pipeThrough(new LexerTransformer()) .pipeTo(new WritableStream({ write(tokens) { for (const token of tokens) { console.log(token); } }}));// { type: Field, value: "name" }// FieldDelimiter// { type: Field, value: "age" }// RecordDelimiter// { type: Field, value: "Alice" }// FieldDelimiter// { type: Field, value: "20" }// RecordDelimiter Copy
new ReadableStream({ start(controller) { controller.enqueue("name,age\r\n"); controller.enqueue("Alice,20\r\n"); controller.close(); }}) .pipeThrough(new LexerTransformer()) .pipeTo(new WritableStream({ write(tokens) { for (const token of tokens) { console.log(token); } }}));// { type: Field, value: "name" }// FieldDelimiter// { type: Field, value: "age" }// RecordDelimiter// { type: Field, value: "Alice" }// FieldDelimiter// { type: Field, value: "20" }// RecordDelimiter
Readonly
MDN Reference
Generated using TypeDoc
A transform stream that converts a stream of tokens into a stream of rows.
Example: Parse a CSV with headers by data