You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When attempting to write out CSV data to a Buffer, if the array is empty, and a headers string array is provided, the headers are not output.
Expected behavior
If headers is set to a string array, the headers should be output in the CSV when writing to a Buffer.
Additional context
As a scenario: when generating daily reports, sometimes you will have no data, but you'll still want to produce a file with the headers, to distinguish between "we generated the CSV and there was no data" vs "oops, something went wrong generating the CSV, here's a blank file instead".
The text was updated successfully, but these errors were encountered:
@laurence-myers thanks for reporting. I think an option that allows you to specify writing a CSV with the headers if no data is provided would be the best option to maintain backwards compatibility.
Im thinking writeHeadersIfEmpty which will be defaulted to false.
Let me know what you think and if you have a better name for the option.
Describe the bug
When attempting to write out CSV data to a Buffer, if the array is empty, and a
headers
string array is provided, the headers are not output.To Reproduce
Expected behavior
If
headers
is set to a string array, the headers should be output in the CSV when writing to a Buffer.Additional context
As a scenario: when generating daily reports, sometimes you will have no data, but you'll still want to produce a file with the headers, to distinguish between "we generated the CSV and there was no data" vs "oops, something went wrong generating the CSV, here's a blank file instead".
The text was updated successfully, but these errors were encountered: