Download and uncompress gzip at once

val myGZIP =

returns referring to a gzip file. I would like to use it subsequently in

val gz = new GZIPInputStream(fis)

to be able to process the file

Source.fromInputStream(gz) .

GZIPInputStream requires whereas returns Is there any way to convert and chain reading from URL and decoding gzip format?

Well, you don’t need Source.fromURL at all.

Just check at its implementation, all you need is: url.openStream()


Great, everything works perfectly! Thanks a lot for a prompt response.

The fromFoo API in Source is very confusing to me (and I’m not a user). I suspect it could be simplified. In particular, I think you are not wrong in wanting your use case without dipping back into the Java API.

I don’t know what the “correct” or “best” API would be.

I’m glad there is a workaround.