# Perspective download zip file with several files inside

**URL:** <https://forum.inductiveautomation.com/t/perspective-download-zip-file-with-several-files-inside/75035>\
**Category:** Ignition\
**Tags:** perspective, database\
**Created:** [June 14, 2023, 6:00pm UTC](https://forum.inductiveautomation.com/t/perspective-download-zip-file-with-several-files-inside/75035 "2023-06-14T18:00:54Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [August 23, 2023, 7:15pm UTC](https://forum.inductiveautomation.com/t/perspective-download-zip-file-with-several-files-inside/75035/5 "2023-08-23T19:15:01Z")

</div>

As an exercise to myself, I wanted to see if I could do the same thing with the standard Java library. It produces a jarray as output automatically, and _should_ be more efficient in Jython since it is java-based.

```auto
import java.util.zip.ZipOutputStream as ZipOutputStream
import java.io.ByteArrayOutputStream as ByteArrayOutputStream
import java.util.zip.ZipEntry as ZipEntry

def datasets_to_zip(filenames, datasets):
    byte_stream = ByteArrayOutputStream()
    zip_stream = ZipOutputStream(byte_stream)
    for file_name, dset in zip(filenames, datasets):
        zip_stream.putNextEntry(ZipEntry(file_name))
        zip_stream.write(system.dataset.toCSV(dset))
    zip_stream.close()
    return byte_stream.toByteArray()

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/perspective-download-zip-file-with-several-files-inside/75035)._
