Skip to content

Is there a way to track progress with CsvDataReader? #160

Answered by MarkPflug
0xced asked this question in Q&A
Discussion options

You must be logged in to vote

The way that I've done this before is to use a wrapper stream that counts the bytes passing through it. It works well, but only works for streams where the length is known. If the length of the stream is unknown, then I don't see a way to report progress without buffering the entire file somewhere.

Here is an example:
https://github.com/dataplat/dbatools/pull/8393/files
That example is using the lumenworks CSV parser, but the construction would be the same for my library. Specifically, see the ProgressStream.cs and Import-DbaCsv.ps1 files.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@0xced
Comment options

@MarkPflug
Comment options

@yunhyejoung
Comment options

Answer selected by 0xced
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants