Skip to content

Add open for composed transcodingstreams - #113

Open
jakobnissen wants to merge 2 commits into
JuliaIO:masterfrom
jakobnissen:compose
Open

Add open for composed transcodingstreams#113
jakobnissen wants to merge 2 commits into
JuliaIO:masterfrom
jakobnissen:compose

Conversation

@jakobnissen

Copy link
Copy Markdown
Collaborator

This allows users to easily chain codecs using the do-syntax. Here is an example where the input is chained through four different streams.

julia> using CodecZlib, TranscodingStreams
julia> open(
i -> first(read(i, String), 10),
GzipDecompressorStream ∘ NoopStream ∘ GzipCompressorStream ∘ NoopStream,
"Project.toml"
)
"name = \"Tr"

@jakobnissen

Copy link
Copy Markdown
CollaboratorAuthor

I'll add tests if anyone with the permission to merge gives me the thumbs-up :)

@mkitti
mkitti self-requested a review August 23, 2022 15:45
Comment threadsrc/stream.jl
Comment on lines +208 to +210
function _open(code::Type{<:Type{T}}, io::IO) where {T <: TranscodingStream}
T(io)
end

@mkittimkittiAug 23, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment about what this does?

@mkittimkitti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests

@ViralBShah

Copy link
Copy Markdown
Member

@jakobnissen If helpful and if you are interested, I can give you commit access here.

@mkitti

Copy link
Copy Markdown
Member

This still needs a test.

@ViralBShah

Copy link
Copy Markdown
Member

This still needs a test.

Agree.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@jakobnissen@ViralBShah@mkitti