Hi,
it's possible to zip a file using the following command:
require("fs").zipFile("/path/to/outfile", "/path/to/source/directory", [ "file1", "file2", ... ]);
for example, to zip the contents of file "/tmp/test" into "/tmp/out.zip":
require("fs").zipFile("/tmp/out.zip", "/tmp", [ "test" ]);
The zipped file could then be sent from Foxx to a client application via
response.sendFile("/tmp/out.zip", { });
or be sent to a remote API using
require("internal").download(remoteUrl, require("fs").readBuffer("/tmp/out.zip"), { method: "post" });
or something similar.
That is zip and not gzip, but maybe it helps anyway. I think there is no gzip function exposed in Foxx, but it could be added if necessary.
Best regards
J