Parasol Framework
  • Gallery
  • API
  • Wiki
  • GitHub
    • Audio
    • Core
    • Display
    • Fluid
    • Font
    • Network
    • Vector
    • Audio
    • Sound
    • File
    • MetaClass
    • Module
    • StorageDevice
    • Task
    • Thread
    • Time
    • Compression
    • Config
    • Script
    • XML
    • Controller
    • BlurFX
    • ColourFX
    • CompositeFX
    • ConvolveFX
    • DisplacementFX
    • FilterEffect
    • FloodFX
    • ImageFX
    • LightingFX
    • MergeFX
    • MorphologyFX
    • OffsetFX
    • RemapFX
    • SourceFX
    • TurbulenceFX
    • WaveFunctionFX
    • Scintilla
    • ScintillaSearch
    • Bitmap
    • Clipboard
    • Display
    • Document
    • Font
    • Picture
    • Pointer
    • Surface
    • SVG
    • ClientSocket
    • HTTP
    • NetSocket
    • Proxy
    • Vector
    • VectorClip
    • VectorColour
    • VectorEllipse
    • VectorFilter
    • VectorGradient
    • VectorGroup
    • VectorImage
    • VectorPath
    • VectorPattern
    • VectorPolygon
    • VectorRectangle
    • VectorScene
    • VectorShape
    • VectorSpiral
    • VectorText
    • VectorTransition
    • VectorViewport
    • VectorWave

Compression Class

Compresses data into archives, supporting a variety of compression formats.

The Compression class provides an interface to compress and decompress data. It provides support for file based compression as well as memory based compression routines. The base class uses zip algorithms to support pkzip files, while other forms of compressed data can be supported by installing additional compression sub-classes.

The following examples demonstrate basic usage of compression objects in Fluid:

// Create a new zip archive and compress two files.

cmp = obj.new('compression', { path='temp:result.zip', flags='!NEW' } )
err = cmp.mtCompressFile('config:defs/compression.def', '')
err = cmp.mtCompressFile('config:defs/core.def', '')

// Decompress all *.def files in the root of an archive.

cmp = obj.new('compression', { path='temp:result.zip' } )
err = cmp.mtDecompressFile('*.def', 'temp:')

It is strongly advised that Compression objects are created for the purpose of either writing to, or reading from the target archive. The class is not designed for both purposes simultaneously, particularly due to considerations for maximising operational speed.

If data is to be encrypted or decrypted, set the Password field with a null-terminated encryption string. If the password for an encrypted file, errors will be returned when trying to decompress the information (the source archive may be reported as a corrupted file).

To list the contents of an archive, use the Scan() method.

To adjust the level of compression used to pack each file, set the CompressionLevel field to a value between 0 and 100%.

This code is based on the work of Jean-loup Gailly and Mark Adler.

Structure

The Compression class consists of the following fields:

Access
NameTypeComment
  ArchiveNameSTRINGApply an archive name to the object, allowing it to be used as a named object in the file system.

Setting the ArchiveName will allow a Compression object's files to be accessible using standard file system paths. This is achieved through use of the archive: volume, which is a virtual filesystem included in the Core API.

  CompressionLevelINTThe compression level to use when compressing data.

The level of compression that is used when compressing data is determined by the value in this field. Values range between 0 for no compression and 100 for maximum compression. The speed of compression decreases with higher values, but the compression ratio will improve.

  FeedbackFUNCTIONProvides feedback during the de/compression process.

To receive feedback during any de/compression process, set a callback routine in this field. The format for the callback routine is ERR Function(*Compression, *CompressionFeedback).

For object classes, the object that initiated the de/compression process can be learned by calling the Core's CurrentContext() function.

During the processing of multiple files, any individual file can be skipped by returning ERR::Skip and the entire process can be cancelled by returning ERR::Terminate. All other error codes are ignored.

The CompressionFeedback structure consists of the following fields:

FieldTypeDescription
FeedbackIDFDBSet to one of the FDB event indicators
IndexINTIndex of the current file
PathCSTRINGName of the current file/path in the archive
DestCSTRINGDestination file/path during decompression
ProgressINT64Progress indicator (byte position for the file being de/compressed).
OriginalSizeINT64Original size of the file
CompressedSizeINT64Compressed size of the file
YearINT16Year of the original file's datestamp.
MonthINT16Month of the original file's datestamp.
DayINT16Day of the original file's datestamp.
HourINT16Hour of the original file's datestamp.
MinuteINT16Minute of the original file's datestamp.
SecondINT16Second of the original file's datestamp.
  FlagsCMFOptional flags.
NameDescription
CMF::APPLY_SECURITYWhen decompressing, apply individual file permissions if they are available in the compression file.
CMF::CREATE_FILECreate a new archive only if the source file does not already exist.
CMF::NEWForce the creation of a new file archive. Any existing file data at the target location will be destroyed.
CMF::NO_LINKSTreat symbolic links as normal files/folders.
CMF::PASSWORDA password has been set on the object.
CMF::READ_ONLYForces read-only access, which is strongly recommended if an existing archive is being opened with no modifications intended. If this flag is not set, initialisation can fail if the user does not have write access to the source file.
  MinOutputSizeINTIndicates the minimum output buffer size that will be needed during de/compression.

This field indicates the minimum allowable buffer size for output during decompression and compression processing. This field must be checked before allocating your own buffers for holding compressed and decompressed output, as failing to allocate enough buffer space is extremely likely to result in overflow errors.

  OutputOBJECTIDResulting messages will be sent to the object referred to in this field.

If this field is set to a valid object ID, text messages will be sent to that object when the compression object is used. This can be helpful for notifying the user of the results of compression, decompression and removal of files.

The target object must be capable of processing incoming text from data channels.

  PasswordSTRINGRequired if an archive needs an encryption password for access.

Set the Password field if an archive will use a password for the encryption of its contents. The string must be null-terminated and not more than 128 bytes in length.

It is recommended that the Password is set before or immediately after initialisation. To change the password of an existing archive, create a new compression object with the desired password and transfer the existing data across to it.

  PathSTRINGSet if the compressed data originates from, or is to be saved to a file source.

To load or create a new file archive, set the Path field to the path of that file.

  PermissionsPERMITDefault permissions for decompressed files are defined here.

By default the permissions of files added to an archive are derived from their source location. This behaviour can be over-ridden by setting the Permissions field. Valid permission flags are outlined in the File class.

NameDescription
PERMIT::ALL_DELETESynonym for EVERYONE_DELETE
PERMIT::ALL_EXECSynonym for EVERYONE_EXEC
PERMIT::ALL_READSynonym for EVERYONE_READ
PERMIT::ALL_WRITESynonym for EVERYONE_WRITE
PERMIT::ARCHIVEMarks the file for future backup. The flag should be cleared after the backup has succeeded.
PERMIT::DELETEOwner can delete. If the file system does not support this, deletion is enabled via the WRITE flag.
PERMIT::EVERYONE_ACCESSSynonym for EVERYONE_READ | EVERYONE_WRITE | EVERYONE_EXEC | EVERYONE_DELETE
PERMIT::EVERYONE_DELETESynonym for DELETE | GROUP_DELETE | OTHERS_DELETE
PERMIT::EVERYONE_EXECSynonym for EXEC | GROUP_EXEC | OTHERS_EXEC
PERMIT::EVERYONE_READSynonym for READ | GROUP_READ | OTHERS_READ
PERMIT::EVERYONE_READWRITESynonym for EVERYONE_READ | EVERYONE_WRITE
PERMIT::EVERYONE_WRITESynonym for WRITE | GROUP_WRITE | OTHERS_WRITE
PERMIT::EXECUser/Owner can execute.
PERMIT::GROUPSynonym for GROUP_READ | GROUP_WRITE | GROUP_EXEC | GROUP_DELETE
PERMIT::GROUPIDAllows executables to run with a set group id.
PERMIT::GROUP_DELETEGroup members can delete.
PERMIT::GROUP_EXECGroup members can execute.
PERMIT::GROUP_READGroup members can read.
PERMIT::GROUP_WRITEGroup members can write.
PERMIT::HIDDENRecommends that the file is hidden from view by default.
PERMIT::INHERITInherit permissions from parent folder and logical OR them with preset permission flags.
PERMIT::NETWORKFile is hosted on another machine.
PERMIT::OFFLINEFile content for this networked file has not been cached on the local PC.
PERMIT::OTHERSSynonym for OTHERS_READ | OTHERS_WRITE | OTHERS_EXEC | OTHERS_DELETE
PERMIT::OTHERS_DELETEOthers can delete.
PERMIT::OTHERS_EXECOthers can execute.
PERMIT::OTHERS_READOthers can read.
PERMIT::OTHERS_WRITEOthers can write.
PERMIT::PASSWORDFile is password protected.
PERMIT::READUser/Owner has read access. This will not allow compiled code to be executed.
PERMIT::USERSynonym for READ | WRITE | EXEC | DELETE
PERMIT::USERIDAllows executables to run with a set user id.
PERMIT::USER_EXECSynonym for EXEC
PERMIT::USER_READSynonym for READ
PERMIT::USER_WRITESynonym for WRITE
PERMIT::WRITEUser/Owner can write.
  SizeINT64Indicates the size of the source archive, in bytes.
  TotalOutputINT64The total number of bytes that have been output during the compression or decompression of streamed data.
  UncompressedSizeINT64The total decompressed size of all files in an archive.

If you would like to know the total number of bytes that have been compressed into a compression object, read this field. This will tell you the maximum byte count used if every file were to be decompressed. Header and tail information that may identify the compressed data is not included in the total.

  WindowBitsINTSpecial option for certain compression formats.

The WindowBits field defines the size of the sliding window frame for the default compression format (DEFLATE), but may also be of use to other compression formats that use this technique.

For DEFLATE compression, the window bits range must lie between 8 and 15. Please note that if the value is negative, the algorithm will not output the traditional zlib header information.

To support GZIP decompression, please set the WindowBits value to 47.

Actions

The following actions are currently supported:

FlushFlushes all pending actions.

Methods

The following methods are currently supported:

CompressBufferCompresses a plain memory area into an empty buffer.
ERR cmp::CompressBuffer(OBJECTPTR Object, APTR Input, INT InputSize, APTR Output, INT OutputSize, INT * Result)
ParameterDescription
InputPointer to the source data.
InputSizeByte length of the source data.
OutputPointer to a destination buffer.
OutputSizeAvailable space in the destination buffer.
ResultThe size of the compressed data will be returned in this parameter.

This method provides a simple way of compressing a memory area into a buffer. It requires a reference to the source data and a buffer large enough to accept the compressed information. Generally the destination buffer should be no smaller than 75% of the size of the source data. If the destination buffer is not large enough, an error of ERR::BufferOverflow will be returned. The size of the compressed data will be returned in the Result parameter.

To decompress the data that is output by this function, use the DecompressBuffer() method.

The compression method used to compress the data will be identified in the first 32 bits of output, for example, ZLIB. The following 32 bits will indicate the length of the compressed data section, followed by the data itself.

Error Codes
OkayThe data was compressed successfully. The Result parameter indicates the size of the compressed data.
FailedGeneral failure.
ArgsInvalid arguments passed to function.
BufferOverflowThe output buffer is not large enough.
NullArgsFunction call missing argument value(s)
CompressFileAdd files to a compression object.
ERR cmp::CompressFile(OBJECTPTR Object, CSTRING Location, CSTRING Path)
ParameterDescription
LocationThe location of the file(s) to add.
PathThe path that is prefixed to the file name when added to the compression object. May be NULL for no path.

The CompressFile method is used to add new files and folders to a compression object. The client must supply the Location of the file to compress, as well as the Path that is prefixed to the file name when it is in the compression object. The Location parameter accepts wildcards, allowing multiple files to be processed in a single function call.

To compress all contents of a folder, specify its path in the Location parameter and ensure that it is fully qualified by appending a forward slash or colon character.

The Path parameter must include a trailing slash when targeting a folder, otherwise the source file will be renamed to suit the target path. If the Path starts with a forward slash and the source is a folder, the name of that folder will be used in the target path for the compressed files and folders.

Error Codes
OkayThe file was added to the compression object.
FileAn error was encountered when trying to open the source file.
ArgsInvalid arguments passed to function.
NoSupportThe sub-class does not support this method.
NoPermissionThe READ_ONLY flag has been set on the compression object.
CompressStreamCompresses streamed data into a buffer.
ERR cmp::CompressStream(OBJECTPTR Object, APTR Input, INT Length, FUNCTION * Callback, APTR Output, INT OutputSize)
ParameterDescription
InputPointer to the source data.
LengthAmount of data to compress, in bytes.
CallbackThis callback function will be called with a pointer to the compressed data.
OutputOptional. Points to a buffer that will receive the compressed data. Must be equal to or larger than the MinOutputSize field.
OutputSizeIndicates the size of the Output buffer, otherwise set to zero.

Use the CompressStream method to compress incoming streams of data whilst using a minimal amount of memory. The compression process is handled in three phases of Start, Compress and End. The methods provided for each phase are CompressStreamStart(), CompressStream() and CompressStreamEnd().

A compression object can manage only one compression stream at any given time. If it is necessary to compress multiple streams at once, create a compression object for each individual stream.

No meta-information is written to the stream, so the client will need a way to record the total number of bytes that have been output during the compression process. This value must be stored somewhere in order to decompress the stream correctly. There is also no header information recorded to identify the type of algorithm used to compress the stream. We recommend that the compression object's sub-class ID is stored for future reference.

The following C code illustrates a simple means of compressing a file to another file using a stream:

if (auto error = mtCompressStreamStart(compress); error IS ERR::Okay) {
   LONG len;
   LONG cmpsize = 0;
   UBYTE input[4096];
   while ((error = acRead(file, input, sizeof(input), &len)) IS ERR::Okay) {
      if (!len) break; // No more data to read.

      error = mtCompressStream(compress, input, len, &callback, NULL, 0);
      if (error != ERR::Okay) break;

      if (result > 0) {
         cmpsize += result;
         error = acWrite(outfile, output, result, &len);
         if (error != ERR::Okay) break;
      }
   }

   if (error IS ERR::Okay) {
      if ((error = mtCompressStreamEnd(compress, NULL, 0)) IS ERR::Okay) {
         cmpsize += result;
         error = acWrite(outfile, output, result, &len);
      }
   }
}

Please note that, depending on the type of algorithm, this method will not always write data to the output buffer. The algorithm may store a copy of the input and wait for more data for efficiency reasons. Any unwritten data will be resolved when the stream is terminated with CompressStreamEnd(). To check if data was output by this function, either set a flag in the callback function or compare the TotalOutput value to its original setting before CompressStream was called.

Error Codes
OkayOperation successful.
RetryPlease recall the method using a larger output buffer.
ArgsInvalid arguments passed to function.
BufferOverflowThe output buffer is not large enough to contain the compressed data.
NullArgsFunction call missing argument value(s)
CompressStreamEndEnds the compression of an open stream.
ERR cmp::CompressStreamEnd(OBJECTPTR Object, FUNCTION * Callback, APTR Output, INT OutputSize)
ParameterDescription
CallbackRefers to a function that will be called for each compressed block of data.
OutputOptional pointer to a buffer that will receive the compressed data. If not set, the compression object will use its own buffer.
OutputSizeSize of the Output buffer (ignored if Output is NULL).

To end the compression process, this method must be called to write any final blocks of data and remove the resources that were allocated.

The expected format of the Callback function is specified in the CompressStream() method.

Error Codes
OkayOperation successful.
BufferOverflowThe supplied Output buffer is not large enough (check the MinOutputSize field for the minimum allowable size).
NullArgsFunction call missing argument value(s)
CompressStreamStartInitialises a new compression stream.
ERR cmp::CompressStreamStart(OBJECTPTR Object)

The level of compression is determined by the CompressionLevel field value.

Error Codes
OkayOperation successful.
FailedFailed to initialise the decompression process.
DecompressBufferDecompresses data originating from the CompressBuffer() method.
ERR cmp::DecompressBuffer(OBJECTPTR Object, APTR Input, APTR Output, INT OutputSize, INT * Result)
ParameterDescription
InputPointer to the compressed data.
OutputPointer to the decompression buffer.
OutputSizeSize of the decompression buffer.
ResultThe amount of bytes decompressed will be returned in this parameter.

This method is used to decompress data that has been packed using the CompressBuffer() method. A pointer to the compressed data and an output buffer large enough to contain the decompressed data are required. If the output buffer is not large enough to contain the data, the method will write out as much information as it can and then return with an error code of ERR::BufferOverflow.

Error Codes
OkayOperation successful.
ArgsInvalid arguments passed to function.
BufferOverflowThe output buffer is not large enough to hold the decompressed information.
DecompressFileExtracts one or more files from a compression object.
ERR cmp::DecompressFile(OBJECTPTR Object, CSTRING Path, CSTRING Dest, INT Flags)
ParameterDescription
PathThe full path name of the file to extract from the archive.
DestThe destination to extract the file to.
FlagsOptional flags. Currently unused.

Use the DecompressFile() method to decompress a file or files to a destination folder. The exact path name of the compressed file is required for extraction unless using wildcards. A single asterisk in the Path parameter will extract all files in a compression object.

When specifying the Dest parameter, it is recommended that you specify a folder location by using a forward slash at the end of the string. If this is omitted, the destination will be interpreted as a file name. If the destination file already exists, it will be overwritten by the decompressed data.

This method sends feedback at regular intervals during decompression. For further information on receiving feedback, please refer to the Feedback field.

Error Codes
OkayThe file was successfully extracted.
CancelledThe decompression process was cancelled by the feedback mechanism.
FailedGeneral failure.
FileA destination file could not be created.
ArgsInvalid arguments passed to function.
NoDataNo data is available for use.
WriteFailed to write uncompressed information to a destination file.
MissingPathThe object is missing a setting in the Path or Location field.
SeekAn error occurred during a seek operation.
NullArgsFunction call missing argument value(s)
DecompressObjectDecompresses one file to a target object.
ERR cmp::DecompressObject(OBJECTPTR Object, CSTRING Path, OBJECTPTR Object)
ParameterDescription
PathThe location of the source file within the archive. If a wildcard is used, the first matching file is extracted.
ObjectThe target object for the decompressed source data.

The DecompressObject method will decompress a file to a target object, using a series of Write() calls.

This method sends feedback at regular intervals during decompression. For further information on receiving feedback, please refer to the Feedback field.

Note that if decompressing to a File object, the seek position will point to the end of the file after this method returns. Reset the seek position to zero if the decompressed data needs to be read back.

Error Codes
OkayOperation successful.
FailedGeneral failure.
WriteError writing data to file.
MissingPathThe object is missing a setting in the Path or Location field.
SeekAn error occurred during a seek operation.
NullArgsFunction call missing argument value(s)
DecompressStreamDecompresses streamed data to an output buffer.
ERR cmp::DecompressStream(OBJECTPTR Object, APTR Input, INT Length, FUNCTION * Callback, APTR Output, INT OutputSize)
ParameterDescription
InputPointer to data to decompress.
LengthAmount of data to decompress from the Input parameter.
CallbackRefers to a function that will be called for each decompressed block of information.
OutputOptional pointer to a buffer that will receive the decompressed data. If not set, the compression object will use its own buffer.
OutputSizeSize of the buffer specified in Output (value ignored if Output is NULL).

Call DecompressStream repeatedly to decompress a data stream and process the results in a callback routine. The client will need to provide a pointer to the data in the Input parameter and indicate its size in Length. The decompression routine will call the routine that was specified in Callback for each block that is decompressed.

The format of the Callback routine is ERR Function(*Compression, APTR Buffer, LONG Length)

The Buffer will refer to the start of the decompressed data and its size will be indicated in Length. If the Callback routine returns an error of any kind, the decompression process will be stopped and the error code will be immediately returned by the method.

Optionally, the client can specify an output buffer in the Output parameter. This can be a valuable optimisation technique, as it will eliminate the need to copy data out of the compression object's internal buffer.

When there is no more data in the decompression stream or if an error has occurred, the client must call DecompressStreamEnd().

Error Codes
OkayOperation successful.
AllocMemoryA call to AllocMemory() failed to create a new memory block.
BufferOverflowThe output buffer is not large enough.
NullArgsFunction call missing argument value(s)
DecompressStreamEndMust be called at the end of the decompression process.
ERR cmp::DecompressStreamEnd(OBJECTPTR Object, FUNCTION * Callback)
ParameterDescription
CallbackRefers to a function that will be called for each decompressed block of information.

To end the decompression process, this method must be called to write any final blocks of data and remove the resources that were allocated during decompression.

Error Codes
OkayOperation successful.
NullArgsFunction call missing argument value(s)
DecompressStreamStartInitialises a new decompression stream.
ERR cmp::DecompressStreamStart(OBJECTPTR Object)

Use the DecompressStreamStart method to initialise a new decompression stream. No parameters are required.

If a decompression stream is already active at the time that this method is called, all resources associated with that stream will be deallocated so that the new stream can be initiated.

To decompress the data stream, follow this call with repeated calls to DecompressStream() until all the data has been processed, then call DecompressStreamEnd().

Error Codes
OkayOperation successful.
FailedFailed to initialise the decompression process.
FindFind the first item that matches a given filter.
ERR cmp::Find(OBJECTPTR Object, CSTRING Path, INT CaseSensitive, INT Wildcard, struct CompressedItem ** Item)
ParameterDescription
PathSearch for a specific item or items, using wildcards.
CaseSensitiveSet to true if Path comparisons are case-sensitive.
WildcardSet to true if Path uses wildcards.
ItemThe discovered item is returned in this parameter, or NULL if the search failed.

Use the Find() method to search for a specific item in an archive. The algorithm will return the first item that matches the Path string in conjunction with the Case and Wildcard options.

If successful, the discovered item is returned as a !CompressedItem. The result is temporary and values will be discarded on the next call to this method. If persistent values are required, copy the resulting structure immediately after the call.

Error Codes
OkayOperation successful.
SearchA search routine in this function failed.
NoSupportThis request is not supported.
NullArgsFunction call missing argument value(s)
RemoveFileDeletes one or more files from a compression object.
ERR cmp::RemoveFile(OBJECTPTR Object, CSTRING Path)
ParameterDescription
PathThe full path name of the file to delete from the archive.

This method deletes compressed files from a compression object. If the file is in a folder then the client must specify the complete path in conjunction with the file name. Wild cards are accepted if you want to delete multiple files. A Path setting of * will delete an archive's entire contents, while a more conservative Path of documents/ * would delete all files and directories under the documents path. Directories can be declared using either the back-slash or the forward-slash characters.

Depending on internal optimisation techniques, the compressed file may not shrink from deletions until the compression object is closed or the Flush() action is called.

Error Codes
OkayThe file was successfully deleted.
NoSupportThis request is not supported.
NullArgsFunction call missing argument value(s)
ScanScan the archive's index of compressed data.
ERR cmp::Scan(OBJECTPTR Object, CSTRING Folder, CSTRING Filter, FUNCTION * Callback)
ParameterDescription
FolderIf defined, only items within the specified folder are returned. Use an empty string for files in the root folder.
FilterSearch for a specific item or items by name, using wildcards. If NULL or an empty string, all items will be scanned.
CallbackThis callback function will be called with a pointer to a CompressedItem structure.

Use the Scan() method to search an archive's list of items. Optional filtering can be applied using the Folder parameter to limit results to those within a folder, and Filter parameter to apply wildcard matching to item names. Each item that is discovered during the scan will be passed to the function referenced in the Callback parameter. If the Callback function returns ERR::Terminate, the scan will stop immediately. The prototype of the Callback function is ERR Function(*Compression, *CompressedItem).

The CompressedItem structure consists of the following fields:

FieldTypeDescription
OriginalSizeINT64Original size of the file
CompressedSizeINT64Compressed size of the file
Nextstruct CompressedItem *Used only if this is a linked-list.
PathCSTRINGPath to the file (includes folder prefixes). Archived folders will include the trailing slash.
PermissionsPERMITOriginal permissions - see PERMIT flags.
UserIDINTOriginal user ID
GroupIDINTOriginal group ID
OthersIDINTOriginal others ID
FlagsFLFL flags
Createdstruct DateTimeDate and time of the file's creation.
Modifiedstruct DateTimeDate and time last modified.

To search for a single item with a path and name already known, use the Find() method instead.

Error Codes
OkayOperation successful.
NoSupportThis request is not supported.
NullArgsFunction call missing argument value(s)
Compression class documentation © Paul Manias 1996-2025

CMF Type

Compression flags

NameDescription
CMF::APPLY_SECURITYWhen decompressing, apply individual file permissions if they are available in the compression file.
CMF::CREATE_FILECreate a new archive only if the source file does not already exist.
CMF::NEWForce the creation of a new file archive. Any existing file data at the target location will be destroyed.
CMF::NO_LINKSTreat symbolic links as normal files/folders.
CMF::PASSWORDA password has been set on the object.
CMF::READ_ONLYForces read-only access, which is strongly recommended if an existing archive is being opened with no modifications intended. If this flag is not set, initialisation can fail if the user does not have write access to the source file.
Compression module documentation © Paul Manias 1996-2025

PERMIT Type

Permission flags

NameDescription
PERMIT::ALL_DELETESynonym for EVERYONE_DELETE
PERMIT::ALL_EXECSynonym for EVERYONE_EXEC
PERMIT::ALL_READSynonym for EVERYONE_READ
PERMIT::ALL_WRITESynonym for EVERYONE_WRITE
PERMIT::ARCHIVEMarks the file for future backup. The flag should be cleared after the backup has succeeded.
PERMIT::DELETEOwner can delete. If the file system does not support this, deletion is enabled via the WRITE flag.
PERMIT::EVERYONE_ACCESSSynonym for EVERYONE_READ | EVERYONE_WRITE | EVERYONE_EXEC | EVERYONE_DELETE
PERMIT::EVERYONE_DELETESynonym for DELETE | GROUP_DELETE | OTHERS_DELETE
PERMIT::EVERYONE_EXECSynonym for EXEC | GROUP_EXEC | OTHERS_EXEC
PERMIT::EVERYONE_READSynonym for READ | GROUP_READ | OTHERS_READ
PERMIT::EVERYONE_READWRITESynonym for EVERYONE_READ | EVERYONE_WRITE
PERMIT::EVERYONE_WRITESynonym for WRITE | GROUP_WRITE | OTHERS_WRITE
PERMIT::EXECUser/Owner can execute.
PERMIT::GROUPSynonym for GROUP_READ | GROUP_WRITE | GROUP_EXEC | GROUP_DELETE
PERMIT::GROUPIDAllows executables to run with a set group id.
PERMIT::GROUP_DELETEGroup members can delete.
PERMIT::GROUP_EXECGroup members can execute.
PERMIT::GROUP_READGroup members can read.
PERMIT::GROUP_WRITEGroup members can write.
PERMIT::HIDDENRecommends that the file is hidden from view by default.
PERMIT::INHERITInherit permissions from parent folder and logical OR them with preset permission flags.
PERMIT::NETWORKFile is hosted on another machine.
PERMIT::OFFLINEFile content for this networked file has not been cached on the local PC.
PERMIT::OTHERSSynonym for OTHERS_READ | OTHERS_WRITE | OTHERS_EXEC | OTHERS_DELETE
PERMIT::OTHERS_DELETEOthers can delete.
PERMIT::OTHERS_EXECOthers can execute.
PERMIT::OTHERS_READOthers can read.
PERMIT::OTHERS_WRITEOthers can write.
PERMIT::PASSWORDFile is password protected.
PERMIT::READUser/Owner has read access. This will not allow compiled code to be executed.
PERMIT::USERSynonym for READ | WRITE | EXEC | DELETE
PERMIT::USERIDAllows executables to run with a set user id.
PERMIT::USER_EXECSynonym for EXEC
PERMIT::USER_READSynonym for READ
PERMIT::USER_WRITESynonym for WRITE
PERMIT::WRITEUser/Owner can write.
Compression module documentation © Paul Manias 1996-2025

CompressedItem Structure

FieldTypeDescription
OriginalSizeINT64Original size of the file
CompressedSizeINT64Compressed size of the file
Nextstruct CompressedItem *Used only if this is a linked-list.
PathCSTRINGPath to the file (includes folder prefixes). Archived folders will include the trailing slash.
PermissionsPERMITOriginal permissions - see PERMIT flags.
UserIDINTOriginal user ID
GroupIDINTOriginal group ID
OthersIDINTOriginal others ID
FlagsFLFL flags
Createdstruct DateTimeDate and time of the file's creation.
Modifiedstruct DateTimeDate and time last modified.
Compression class documentation © Paul Manias 1996-2025

CompressionFeedback Structure

FieldTypeDescription
FeedbackIDFDBSet to one of the FDB event indicators
IndexINTIndex of the current file
PathCSTRINGName of the current file/path in the archive
DestCSTRINGDestination file/path during decompression
ProgressINT64Progress indicator (byte position for the file being de/compressed).
OriginalSizeINT64Original size of the file
CompressedSizeINT64Compressed size of the file
YearINT16Year of the original file's datestamp.
MonthINT16Month of the original file's datestamp.
DayINT16Day of the original file's datestamp.
HourINT16Hour of the original file's datestamp.
MinuteINT16Minute of the original file's datestamp.
SecondINT16Second of the original file's datestamp.
Compression class documentation © Paul Manias 1996-2025