I'm trying to create a zip file from the object path I'm passing to minio. In minio objects are stored as paths, i.e. my/path/to/file.jpg
.
private void zip(HttpServletResponse response, String bucket, String path) {
try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()) {
zos.putNextEntry(new ZipEntry(path));
StreamUtils.copy(getObjectFromMinio(bucket, path), zos);
zos.closeEntry();
} catch (Exception e) { ... }
}
getObjectFromMinio
uses standard getObject
method.
Everything is fine until I'm trying to build nested folders by passing my/path/
as path argument.
How to build the folder structure correctly inside the zip file with InputStream
?