Skip to content

Streaming decompression? #521

@adamwight

Description

@adamwight

I was surprised to find that the decompress_body step seems to skip decompression when request.into is specified. My use case is to stream a gzipped file through decompression and then into text processing logic, so my expectation was that into: IO.stream() would result in a stream of decompressed text. Instead, it results in an error:

** (ArgumentError) argument error
    (stdlib 6.2.2) io.erl:203: :io.put_chars(:standard_io, <<31, 139, 8, 0, 0, 9, 110, 136, 0, 255, 236, 86, 109, 111, 219, 54, 16, 206, 231, 253, 10, 142, 64, 191, 233, 133, 146, 223, 53, 24, 67, 154, 13, 216, 128, 109, 109, 151, 98, 64, 91, 21, 6, 77, 158, 98, 46, 18, 169, 145, ...>>)
    (req 0.5.16) lib/req/finch.ex:146: anonymous fn/3 in Req.Finch.finch_stream_into_collectable/5
    (finch 0.20.0) lib/finch.ex:377: anonymous fn/3 in Finch.stream/5
    (finch 0.20.0) lib/finch/http1/conn.ex:347: Finch.HTTP1.Conn.receive_response/8
    (finch 0.20.0) lib/finch/http1/conn.ex:131: Finch.HTTP1.Conn.request/8
    (finch 0.20.0) lib/finch/http1/pool.ex:71: anonymous fn/10 in Finch.HTTP1.Pool.request/6
    (nimble_pool 1.1.0) lib/nimble_pool.ex:462: NimblePool.checkout!/4
    iex:4: (file)

This matches the documented behavior which is great, but maybe I misunderstand the point of this limitation. Is streaming decompression simply a lacking feature, or is there a good reason to avoid it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions