-
Notifications
You must be signed in to change notification settings - Fork 655
feat: web streams based encoding/csv #1993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
encoding/csv/stream.ts
Outdated
comment?: string; | ||
} | ||
|
||
export class CSVStream { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could rather make CSVStream
extend TransformStream
, then the only thing you have to do is super()
with the transformstream options; and the variables you defined can just be private properties.
This isnt necessary, but imo just a lot cleaner & direct
encoding/csv/stream.ts
Outdated
@@ -0,0 +1,51 @@ | |||
import { Buffer, BufReader } from "../../io/buffer.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, this is going to be the problem: any of the new streams based APIs are not allowed to depend on any Deno.Reader/Writer APIs. You'll have to wait for #1970 to land
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrote CSVStream
not to depend on Deno.Reader
in c573f87
TextProtoReader
will no longer be needed to implement encoding/csv/stream
🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the CSVStream
should be a TransformStream<string, string[]>
rather than TransformStream<Uint8Array, string[]>
. The text decoding can be done with TextDecoderStream
by the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except a nitpick, and luca's comment, this looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! the PR is still a draft; do you still have things to add? if not, i'd like to get this landed soon
@crowlKats Thanks for the review! I'd like to add more tests later in a separate PR, since the tests are a little low |
This PR tries to implement web streams based
encoding/csv
module.I'm not very familiar with web streams, so any feedback would be appreciated!
Part of #1986
Changes
encoding/csv/stream.ts
encoding/csv/_io.ts
to remove duplicate codes betweenencoding/csv.ts
andencoding/csv/stream.ts