ZIp files Asynchronously using

Skip to first unread message

David P

Mar 4, 2022, 3:17:46 AMMar 4
to vert.x
Hello dear Vertx Community,

I want ot ZIP files suing the like code sample below:

String sourceFile = "test1.txt"; FileOutputStream fos = new FileOutputStream(""); ZipOutputStream zipOut = new ZipOutputStream(fos); File fileToZip = new File(sourceFile); FileInputStream fis = new FileInputStream(fileToZip); ZipEntry zipEntry = new ZipEntry(fileToZip.getName()); zipOut.putNextEntry(zipEntry); byte[] bytes = new byte[1024]; int length; while((length = >= 0) { zipOut.write(bytes, 0, length); } zipOut.close(); fis.close(); fos.close();

How to perform the I/O operation (write to file) Asynchronously (with EventLoop Thread)?
  1. - Is there a way to ZIP files using ONLY Vertx toolbox?
  2. - Is there a way to "bridge" for ZipOutputStream to io.vertx.core.streams.WriteStrea of io.vertx.core.file.AsyncFile?
  3. Else, Should I use a WorkerThread to perform this Synchronous operation?



Jun 21, 2022, 12:45:25 AMJun 21
to vert.x
I also encountered the same issue? Could anyone give some advices?

Julien Viet

Jun 22, 2022, 4:45:18 AMJun 22
to vert.x
I think what should be done is to use a worker thread and work with files

It could be possible to use the event loop by compressing the stream
by chunks along with vertx async files too and not block the event
loop, but it seems a bit technical to achieve and perhaps worthless if
you only need to compress a single file.

> --
> You received this message because you are subscribed to the Google Groups "vert.x" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> To view this discussion on the web, visit

David P

Jun 23, 2022, 11:09:11 AMJun 23
to vert.x
Thanks Julien.

We use a Worker Thread to zip files with


Reply all
Reply to author
0 new messages