Format JavaScript Standard Style as Stylish (i.e. snazzy) output
94
Build a command-line tool that transforms CSV data into JSON format using Node.js streams. The tool should read CSV data from stdin, convert it to JSON, and output the result to stdout.
The tool should:
name, age, city
Alice, 30, Seattle
Bob, 25, Portland[
{"name": "Alice", "age": "30", "city": "Seattle"},
{"name": "Bob", "age": "25", "city": "Portland"}
][{"id":"1","name":"Test"}] @test[] @test[{"x":"a","y":"b","z":"c"},{"x":"d","y":"e","z":"f"}] @test@generates
Create a CLI script that can be executed with node src/csv-to-json-stream.js or piped to like echo "a,b\n1,2" | node src/csv-to-json-stream.js.
/**
* A Transform stream that converts CSV input to JSON output.
* Buffers all input chunks, then processes the complete CSV data
* and outputs a JSON array of objects.
*/
class CsvToJsonStream {
constructor(options);
}
module.exports = CsvToJsonStream;Provides stream transformation capabilities using Node.js Transform streams. Use its implementation pattern as reference for building custom stream transformers.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-snazzydocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10