Returns compressed source as ByteArray or string.
vCompress = ZLib.Compress (Source as Variant, [CompressType as ZLibCompressLevels = ctDefaultCompression], [OutputType as OutputTypes = otByteArray])
| Where | Type | Optional | Default | Description |
|---|---|---|---|---|
| Source | Variant | Source data to compress. ByteArray or String | ||
| CompressType | ZLibCompressLevels | yes | ctDefaultCompression | Compression level. Range from 1 to 9, or special values. |
| OutputType | OutputTypes | yes | otByteArray | Type for the return value. One of ByteArray, Variant ByteArray, String or MultiByte String |
Variant
This function returns variant containing ByteArray, variant ByteArray, String or MultiByte string.
ZLib - Compress file |
Sub CompressFile(SourceFile, DestFile)
Dim ByteArray, ZLib
Set ByteArray = CreateObject("ScriptUtils.ByteArray")
Set ZLib = CreateObject("ScriptUtils.ZLib")
'Read the dsource file
ByteArray.ReadFrom SourceFile
'Compress source data
Set ByteArray = ZLib.Compress(ByteArray.ByteArray)
'Save data to the destination file
ByteArray.SaveAs DestFile
End Sub |
Implements zlib Compress and Uncompress functions. Lets you compress/uncompress files, or send compressed data over http/https connections.
© 1996 - 2009 Antonin Foller, Motobit Software | About, Contacts | e-mail: info@pstruh.cz