Xceed Zip Compression Library Documentation
UseTempFile property
Xceed Zip control reference > Xceed Zip control properties > UseTempFile property

Description

The UseTempFile property influences whether or not the Zip or Convert methods will use a temporary file when creating a new zip file or when writing to an existing zip file.

A temporary file is useful in order to help keep the zip file currently being written to in a consistent state in the event that the current operation fails, is abnormally aborted, or a system crash occurs. A temporary file is also useful when writing to zip files located on write-once media (CD-WORM) or across a network because the zip file is created in the temporary file (usually on a local drive) and written to the destination drive or network location only when the zipping operation is complete. A temporary file also speeds up the zipping operation when creating spanned zip files .

Setting the UseTempFile property to True will cause Xceed Zip to always create a temporary file. Setting it to False will cause Xceed Zip to avoid creating a temporary file if possible. If UseTempFile is set to False, but a temporary file is required (for example, when replacing a file in the destination zip file) then an error code will be returned and files may be skipped (triggering the SkippingFile event).

Data type

Boolean

Default value

True

Declaration (DLL API)  

BOOL XzGetUseTempFile( HXCEEDZIP hZip )

void XzSetUseTempFile( HXCEEDZIP hZip, BOOL bValue )

Remarks

A temporary file is always created when the RemoveFiles method is used. The UseTempFile property must therefore be set to True.

When an operation that causes a temporary file to be created has completed, the temporary file will be removed – even if an error occurs. However, if a system crash or reboot occurs before the operation completes, the temporary file will be left lying about, and must be removed manually.

Applicable methods

Zip, Convert, RemoveFiles

Things you should consider