How to return an zip file from Foxx- arangodb?

17 views Asked by At

The premise is that I want to return a zip file from foxx endpoint. The endpoint would:

-Take a string and put it inside a file

-Return the zip from the response

After some research, it seems not possible due to various reason. I want to make sure my understanding is correct and whether there is an workable solutions:

Approach 1: Using amd-zip module from npm

  • There is an error return from performing an simple zip with a string which is zlib.deflateSync() is undefined. I think it is due to V8 context and nodejs are not the the same.

Approach 2 : Using Jszip-sync: More browser based library.

  • This one will run without an error, but it always return empty result. Testing suggest the sync wrapper does not seemed to work in foxx environment

Approach 3: Using zip function from arango built-in file

  • But as the official document stated, this seems like an extremely bad idea (write file to system, zip it, read back and return inside foxx handler)
0

There are 0 answers