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
{{ message }}
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.
I just push a commit which expose columns inside the info/context object with the cast, info and on_record options. I don't wish to enrich state with columns because I am sort of planning to remove state in the next major release and merge its properties inside state.
Could you have a look at #81c5c8798de8d44446f69b210674fd74c7fe3d7a, in particular the test which illustrate its access and let me know if that works for you. If this is the case, I'll release a new minor version.
However, I'm interesting in having the information about columns before starting the for await of loop. Here is what I would like to do:
const parser = sourceStream.pipe(csv_parse({ columns: true, info: true }));
if (expectedColumnsAreFound(parser))
for await (const {record, info} of parser)
{
// process records
}
Of course, I could move the columns validity test inside the loop, but it would be tested for all records which is a waste of computation time in huge files.
Any suggestion is most welcome.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Is your feature request related to a problem? Please describe.
When using
column: true
option, we need to get the columns and it would be useful to have them as part asinfo
object.Describe the solution you'd like
Currently, I'm doing
parser.options.columns
because I saw in the code thatoptions.columns
is updated when reading the header line.The text was updated successfully, but these errors were encountered: