I am trying to download 2 directories from blob azure storage as bytearray and compress them to zip but i got an error. I saw in web that directory does not really exist in blob storage... I did not really understand how it works so...
Here is my code below :
val dstsData = "/projections/$projectionId/inputs/datasources"
val dstsAss = "/projections/$projectionId/inputs/assumptions"
val dstsDL = "${inputDispatchPath}inputs.zip"
val inputsDatasources = withContext(Dispatchers.IO) {
azureBatch.filesystem.downloadAsByteArray(dstsData)
}
val inputsAssumptions = withContext(Dispatchers.IO) {
azureBatch.filesystem.downloadAsByteArray(dstsAss)
}
val baos = ByteArrayOutputStream()
val zipOutputStream = ZipOutputStream(baos)
val entry = ZipEntry("inputs.zip")
entry.size = inputsDatasources.size.toLong() + inputsAssumptions.size.toShort()
withContext(Dispatchers.IO){
zipOutputStream.putNextEntry(entry)
zipOutputStream.write(inputsDatasources)
zipOutputStream.write(inputsAssumptions)
zipOutputStream.closeEntry()
zipOutputStream.close()
}
val file = ezEventBus.request(
ServiceIORequest.WriteURLFor(
user,
dstsDL,
baos.toByteArray().size.toLong()
),
correlationId
)
file .uploader.upload(
vertx,
webClient,
Buffer.buffer(baos.toByteArray()),
baos.toByteArray().size.toLong())
Do you have an idea? Thanks a lot
Regards
Here is my link to my stackoverflow question: