zemirco / json2csv

Convert json to csv with column titles
http://zemirco.github.io/json2csv
MIT License
2.72k stars 363 forks source link

Transform should accept streams of Objects, not just strings #330

Closed dharmax closed 5 years ago

dharmax commented 6 years ago

A Little Feature request

i expected it to work out of the box, but apparently i had to stringify my JSON objects, because otherwise Transform threw an exception stating it accepts either strings or buffers. This feature is useful when streaming from database queries (in my case, it was using the streaming capabilities of the mongodb driver), etc.

  1. Include the version of json2csv used: 4.2.1
  2. Include your node version/browser vendor and version: 10.12
juanjoDiaz commented 6 years ago

Node.js streams work either on strings/buffers mode or in object mode. Have you read about object mode in the documentation? I think that that's what you want.

If you want something else. Can you elaborate a bit? And possibly provide a code sample showing what you would like?

juanjoDiaz commented 5 years ago

Closing since I think that this is resolved. Feel free to re-open if you feel that something is still missing.