Get file zip from zip archive ? #23
Replies: 3 comments
-
Here is a snippet which gets output size before decompressing the file in memory Dim lIdx As Long
Dim vInfo As Variant
Dim lSize As Long
Dim baOutput() As Byte
With New cZipArchive
.OpenArchive "D:\TEMP\aaa.zip"
For lIdx = 0 To .FileCount - 1
vInfo = .FileInfo(lIdx)
If LCase$(vInfo(0)) = "mem\report.pdf" Then
lSize = vInfo(3)
Debug.Print "Reported output size is " & lSize
Exit For
End If
Next
.Extract baOutput, "mem\report.pdf"
Debug.Print "Decompressed size is " & UBound(baOutput) + 1
End With
WriteBinaryFile "D:\Temp\report.pdf", baOutput You can check out Here is the enum with indexes into Private Enum ZipInfoIndexesEnum
zipIdxFileName
zipIdxAttributes
zipIdxCrc32
zipIdxSize
zipIdxCompressedSize
zipIdxComment
zipIdxLastModified
zipIdxMethod
zipIdxOffset
zipIdxFlags
End Enum You can use these like |
Beta Was this translation helpful? Give feedback.
-
Hi , Perfect :) |
Beta Was this translation helpful? Give feedback.
-
Btw, in the latest version of the class one can get entry's uncompressed file size using
|
Beta Was this translation helpful? Give feedback.
-
Hi (wqweto),
Using this model :
Is there a way to know the size of "mem/report.pdf" before writing it in "C:\TEMP" ?
Tried by search in the doc but "size" word appears too much times to makes searching revelant.
Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions