# Zip multiple files as a stream (on the fly)

**URL:** <https://discuss.akka.io/t/zip-multiple-files-as-a-stream-on-the-fly/5360>\
**Category:** Akka Streams & Alpakka\
**Tags:** streams\
**Created:** [November 6, 2019, 11:07am UTC](https://discuss.akka.io/t/zip-multiple-files-as-a-stream-on-the-fly/5360 "2019-11-06T11:07:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tg44](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/tg44/32/1099_2.png) [@tg44](https://discuss.akka.io/u/tg44)\
**Post date:** [November 6, 2019, 11:07am UTC](https://discuss.akka.io/t/zip-multiple-files-as-a-stream-on-the-fly/5360/1 "2019-11-06T11:07:08Z")

</div>

Hy there!

I have multiple akka-http endpoints with streaming csv-s:

```auto
override def bytes(data: Data)(
                implicit lang: Lang,
                messages: MessageCache,
                executionContext: ExecutionContext
            ): Source[ByteString, NotUsed] = {
              Source
                .single(csvEv.header)
                .concat(
                  Source(data.toList).map(_.toCsv)
                )
                .via(CsvFormatting.format())
            }

```

The customer wants a new endpoint where they can get all of the csv-s as a big zip.

Is there any prebuild solution in the streams or the alpakka that can be used without hacking around? (Checked the alpakka-files not so helpful for this, also checked the streams docs)

I found that we have Compression.gzip which is a Bytestring-Bytestring flow, but that will not work if I simply concat the sources one by one. Somewhat I should inject file-headers to the stream I think.

Other method would be to write down the csv-s as files zip locally and give back the zip, but I think that is a super ineffective solution…

I’ll trying to came up with a useable solution but would be nice if sb could give me directions.

---

<div class="post-metadata">

**Author:** ![ennru](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.akka.io/ennru/32/1495_2.png) [@ennru](https://discuss.akka.io/u/ennru)\
**Post date:** [November 6, 2019, 12:48pm UTC](https://discuss.akka.io/t/zip-multiple-files-as-a-stream-on-the-fly/5360/2 "2019-11-06T12:48:33Z")

</div>

Hi @tg44

Such a thing has recently been contributed to Alpakka File: [https://doc.akka.io/docs/alpakka/snapshot/file.html#zip-archive](https://doc.akka.io/docs/alpakka/snapshot/file.html#zip-archive)

We plan to cut an Alpakka 2.0.0-M1 release later this week which will contain it. Until than you may resort to the snapshot build.

Cheers,  
Enno.
