vb.net - Convert DotNetZip ZipFile to byte array -


i've built dotnetzip zipfile several entries. i'd convert byte array can download using download construct below.

   using wrkzip new zipfile         '----- create zip, add memory stream----------        n integer = 0 wrkar.count - 1            wrkfs = wrkar(n)            wrkzip.addentry(wrkfs.filename, wrkfs.contentstream)        next     dim wrkbytes() byte    dim wrkfilename string = "test.txt"     ===> wrkbytes = converttobytearray(wrkzip) <====       context.response.clear()         context.response.contenttype = "application/force-download"         context.response.addheader("content-disposition", "attachment; filename=" & wrkfilename)         context.response.binarywrite(wrkbytes)         wrkbytesinstream = nothing         context.response.end() 

i recognize there zipfile method this:

wrkzip.save(context.response.outputstream) 

however, i've got difficult bug in using that, described here:

dotnetzip download works in 1 site, not another

so i'm looking short term workaround. short story on bug the zipfile writes disk fine, , downloads fine in similar website; doesn't work in case need right now.

so, how convert dotnetzip zipfile byte array? i've looked @ other answers don't describe particular case of converting whole, loaded zipfile.

use memorystream contents byte array:

dim ms new memorystream wrkzip.save(ms) wrkbytes = ms.toarray() 

Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -