Tar C Reference Documentation

Tar

Current Version: 11.5.0

Chilkat.Tar

Create, list, verify, filter, and extract TAR archives and compressed TAR formats.

Chilkat.Tar creates, verifies, lists, and extracts TAR archives, including compressed TAR formats such as .tar.gz, .tgz, .tar.bz2, and .tar.Z. It supports adding individual files and directory trees, controlling archive paths, preserving or overriding file permissions, filtering included or extracted files, extracting from memory, extracting selected entries to memory or BinData, producing XML listings, and creating Debian .deb package archives from control and data tarballs.

Create TAR archives

Add files or directory trees and write standard TAR output, with control over archive paths, directory handling, and write format.

Compressed TAR formats

Work with common compressed archive forms such as .tar.gz, .tgz, .tar.bz2, and .tar.Z.

List and verify contents

Inspect archive entries, verify archive structure, and produce XML listings for display, logging, or programmatic processing.

Selective extraction

Extract entire archives or selected entries, including workflows that extract matching files directly to memory or BinData.

Filters and paths

Include or exclude files using filters, control relative paths in the archive, and manage how entries are restored during extraction.

Permissions and packages

Preserve or override UNIX-style permissions and create Debian .deb package archives from control and data tarballs.

Common pattern: Use Tar when the data is a TAR archive or a compressed TAR archive. Configure the archive paths, filters, permissions, and compression format, then create, list, verify, or extract the archive as needed. Use Chilkat.Zip for ZIP archives, Chilkat.Gzip for a single GZIP stream, and Chilkat.Compression for raw compression operations.

Create/Dispose

HCkTar instance = CkTar_Create();
// ...
CkTar_Dispose(instance);
HCkTar CkTar_Create(void);

Creates an instance of the HCkTar object and returns a handle ("void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkTar_Dispose(HCkTar handle);

Objects created by calling CkTar_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function. Also, any handle returned by a Chilkat "C" function must also be freed by the application by calling the appropriate Dispose method, such as CkTar_Dispose.

Callback Functions

void CkTar_setAbortCheck(HCkTar cHandle, BOOL (*fnAbortCheck)(void));

Provides the opportunity for a method call to be aborted. If TRUE is returned, the operation in progress is aborted. Return FALSE to allow the current method call to continue. This callback function is called periodically based on the value of the HeartbeatMs property. (If HeartbeatMs is 0, then no callbacks are made.) As an example, to make 5 AbortCheck callbacks per second, set the HeartbeatMs property equal to 200.

void CkTar_setPercentDone(HCkTar cHandle, BOOL (*fnPercentDone)(int pctDone));

Provides the percentage completed for any method that involves network communications or time-consuming processing (assuming it is a method where a percentage completion can be measured). This callback is only called when it is possible to know a percentage completion, and when it makes sense to express the operation as a percentage completed. The pctDone argument will have a value from 1 to 100. For methods that complete very quickly, the number of PercentDone callbacks will vary, but the final callback should have a value of 100. For long running operations, no more than one callback per percentage point will occur (for example: 1, 2, 3, ... 98, 99, 100).

This callback counts as an AbortCheck callback, and takes the place of the AbortCheck event when it fires.

The return value indicates whether the method call should be aborted, or whether it should proceed. Return TRUE to abort, and FALSE to proceed.

void CkTar_setProgressInfo(HCkTar cHandle, void (*fnProgressInfo)(const char *name, const char *value));

This is a general callback that provides name/value information about what is happening at certain points during a method call. To see the information provided in ProgressInfo callbacks, if any, write code to handle this event and log the name/value pairs. Most are self-explanatory.

void CkTar_setTaskCompleted(HCkTar cHandle, void (*fnTaskCompleted)(HCkTask hTask));

Called in the background thread when an asynchronous task completes. (Note: When an async method is running, all callbacks are in the background thread.)

Properties

CaptureXmlListing
BOOL CkTar_getCaptureXmlListing(HCkTar cHandle);
void CkTar_putCaptureXmlListing(HCkTar cHandle, BOOL newVal);
Introduced in version 9.5.0.46

Controls whether extraction methods also capture an XML inventory of the archive. When set to TRUE, methods such as Untar, UntarGz, UntarBz2, and UntarZ store the listing in XmlListing. The XML has the same structure as the string returned by ListXml. The default is FALSE.

Inspect without extracting: Set CaptureXmlListing and SuppressOutput to TRUE before an untar operation to scan the archive and obtain its XML listing without writing archive entries to disk.

top
Charset
void CkTar_getCharset(HCkTar cHandle, HCkString retval);
void CkTar_putCharset(HCkTar cHandle, const char *newVal);
const char *CkTar_charset(HCkTar cHandle);

Specifies the character encoding used to decode filenames stored in a TAR archive during extraction. The default is utf-8, which is normally appropriate for modern archives.

This property affects archive entry names only. It does not convert or otherwise alter the contents of extracted files. TAR archives written by the WriteTar* methods store filenames as UTF-8.

Filename interoperability: The original TAR header format does not always identify the character encoding of a filename. Change this property only when an older archive is known to use a different encoding.

top
DebugLogFilePath
void CkTar_getDebugLogFilePath(HCkTar cHandle, HCkString retval);
void CkTar_putDebugLogFilePath(HCkTar cHandle, const char *newVal);
const char *CkTar_debugLogFilePath(HCkTar cHandle);

If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. This logging helps identify the context and history of Chilkat calls leading up to any crash or hang, aiding in debugging.

Enabling the VerboseLogging property provides more detailed information. This property is mainly used for debugging rare instances where a Chilkat method call causes a hang or crash, which should generally not happen.

Possible causes of hangs include:

  • A timeout property set to 0, indicating an infinite timeout.
  • A hang occurring within an event callback in the application code.
  • An internal bug in the Chilkat code causing the hang.

More Information and Examples
top
DirMode
int CkTar_getDirMode(HCkTar cHandle);
void CkTar_putDirMode(HCkTar cHandle, int newVal);

Specifies the UNIX permission bits written to the TAR header for directory entries created by the WriteTar* methods. The default is octal 0755, which represents rwxr-xr-x.

Archive metadata: This value records permissions in the archive. Whether the exact permissions are restored during extraction depends on the destination operating system, filesystem, process privileges, and local security policy.

top
DirPrefix
void CkTar_getDirPrefix(HCkTar cHandle, HCkString retval);
void CkTar_putDirPrefix(HCkTar cHandle, const char *newVal);
const char *CkTar_dirPrefix(HCkTar cHandle);

Specifies a path prefix to prepend to entries when a TAR archive is created. For example, setting this property to subdir1 causes an entry such as report.txt to be stored as subdir1/report.txt.

The prefix changes only the path stored in the archive; it does not rename or move the source file on disk.

AddFile2 exception: AddFile2 explicitly supplies the complete path within the archive, so DirPrefix is not applied to files added by that method.

top
FileMode
int CkTar_getFileMode(HCkTar cHandle);
void CkTar_putFileMode(HCkTar cHandle, int newVal);

Specifies the UNIX permission bits written to the TAR header for ordinary file entries created by the WriteTar* methods. The default is octal 0644, which represents rw-r--r--.

Shell scripts: Files recognized as shell scripts use ScriptFileMode instead, allowing executable permissions to be recorded separately.

top
GroupId
int CkTar_getGroupId(HCkTar cHandle);
void CkTar_putGroupId(HCkTar cHandle, int newVal);

Specifies the numeric group identifier (GID) written to TAR headers when an archive is created. The default value is 1000.

Ownership metadata: A stored GID is archive metadata. Restoring ownership may require elevated privileges and may be ignored or mapped differently on non-UNIX systems.

top
GroupName
void CkTar_getGroupName(HCkTar cHandle, HCkString retval);
void CkTar_putGroupName(HCkTar cHandle, const char *newVal);
const char *CkTar_groupName(HCkTar cHandle);

Specifies the group name written to TAR headers when an archive is created. By default, Chilkat uses the username of the account running the application.

Name versus numeric ID: TAR headers can contain both a group name and the numeric GroupId. Extraction tools and operating systems may give different precedence to these fields.

top
HeartbeatMs
int CkTar_getHeartbeatMs(HCkTar cHandle);
void CkTar_putHeartbeatMs(HCkTar cHandle, int newVal);

Specifies the approximate interval, in milliseconds, between AbortCheck event callbacks during supported long-running operations. The default is 0, which disables periodic AbortCheck callbacks.

Cancellation is cooperative: A callback can request that an operation stop, but the request is observed only when the running method reaches a cancellation check. Short operations may finish before a callback occurs.

More Information and Examples
top
LastErrorHtml
void CkTar_getLastErrorHtml(HCkTar cHandle, HCkString retval);
const char *CkTar_lastErrorHtml(HCkTar cHandle);

Provides HTML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorText
void CkTar_getLastErrorText(HCkTar cHandle, HCkString retval);
const char *CkTar_lastErrorText(HCkTar cHandle);

Provides plain text information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastErrorXml
void CkTar_getLastErrorXml(HCkTar cHandle, HCkString retval);
const char *CkTar_lastErrorXml(HCkTar cHandle);

Provides XML-formatted information about the last called method or property. If a method call fails or behaves unexpectedly, check this property for details. Note that information is available regardless of the method call's success.

top
LastMethodSuccess
BOOL CkTar_getLastMethodSuccess(HCkTar cHandle);
void CkTar_putLastMethodSuccess(HCkTar cHandle, BOOL newVal);

Indicates the success or failure of the most recent method call: TRUE means success, FALSE means failure. This property remains unchanged by property setters or getters. This method is present to address challenges in checking for null or Nothing returns in certain programming languages. Note: This property does not apply to methods that return integer values or to boolean-returning methods where the boolean does not indicate success or failure.

top
MatchCaseSensitive
BOOL CkTar_getMatchCaseSensitive(HCkTar cHandle);
void CkTar_putMatchCaseSensitive(HCkTar cHandle, BOOL newVal);
Introduced in version 9.5.0.46

Controls whether the patterns in MustMatch and MustNotMatch are matched case-sensitively. The default is FALSE.

Cross-platform behavior: Case sensitivity in the archive filter is independent of whether the local filesystem itself treats filenames as case-sensitive.

top
MustMatch
void CkTar_getMustMatch(HCkTar cHandle, HCkString retval);
void CkTar_putMustMatch(HCkTar cHandle, const char *newVal);
const char *CkTar_mustMatch(HCkTar cHandle);
Introduced in version 9.5.0.46

Specifies an inclusion pattern applied when creating or extracting TAR archives, including compressed TAR formats. A candidate path is included or extracted only when it matches this pattern. The default is an empty string, which permits all paths.

The pattern may contain zero or more asterisks (*), where each asterisk matches zero or more characters. For example, *.txt selects paths ending in .txt. Case handling is controlled by MatchCaseSensitive.

Combined filters: If both MustMatch and MustNotMatch are set, a path must satisfy the inclusion pattern and must not satisfy the exclusion pattern.

top
MustNotMatch
void CkTar_getMustNotMatch(HCkTar cHandle, HCkString retval);
void CkTar_putMustNotMatch(HCkTar cHandle, const char *newVal);
const char *CkTar_mustNotMatch(HCkTar cHandle);
Introduced in version 9.5.0.46

Specifies an exclusion pattern applied when creating or extracting TAR archives, including compressed TAR formats. A candidate path that matches this pattern is skipped. The default is an empty string, which excludes nothing.

The pattern may contain zero or more asterisks (*), where each asterisk matches zero or more characters. For example, *.obj skips paths ending in .obj. Case handling is controlled by MatchCaseSensitive.

Exclusion takes effect after inclusion: When both filters are set, matching MustMatch does not override a match in MustNotMatch.

top
NoAbsolutePaths
BOOL CkTar_getNoAbsolutePaths(HCkTar cHandle);
void CkTar_putNoAbsolutePaths(HCkTar cHandle, BOOL newVal);

Controls whether absolute archive paths are converted to relative paths during extraction. When TRUE, a leading / or \ is removed before the entry is written. The default is TRUE.

Recommended security setting: Keep this property enabled when extracting archives you did not create. Also extract untrusted archives into a dedicated directory and inspect their entry names before relying on the extracted content.

top
NumDirRoots
int CkTar_getNumDirRoots(HCkTar cHandle);

Returns the number of directory roots currently registered for archive creation by calls to AddDirRoot and AddDirRoot2. Individual files added with AddFile or AddFile2 are not included in this count.

Use zero-based indexes from 0 through NumDirRoots - 1 with GetDirRoot.

top
PercentDoneScale
int CkTar_getPercentDoneScale(HCkTar cHandle);
void CkTar_putPercentDoneScale(HCkTar cHandle, int newVal);
Introduced in version 9.5.0.49

Specifies the value reported by PercentDone when an eligible operation is 100% complete. The default is 100. Increasing the scale allows finer-grained integer progress values; for example, a scale of 1000 allows 453 to represent 45.3%.

The value is clamped to the range 10 through 100000. This property is available only in environments that support event callbacks, and only methods for which measurable progress is available emit percentage updates.

Scale, not frequency: A larger scale increases the numeric resolution of progress values but does not guarantee a callback for every possible value.

top
ScriptFileMode
int CkTar_getScriptFileMode(HCkTar cHandle);
void CkTar_putScriptFileMode(HCkTar cHandle, int newVal);

Specifies the UNIX permission bits written to TAR headers for shell-script files recognized by extensions such as .sh, .csh, .bash, and .bsh. The default is octal 0755, which records executable permissions.

Other files: Non-script files use FileMode; directories use DirMode.

top
SuppressOutput
BOOL CkTar_getSuppressOutput(HCkTar cHandle);
void CkTar_putSuppressOutput(HCkTar cHandle, BOOL newVal);
Introduced in version 9.5.0.46

Controls whether untar operations write extracted files and directories to the filesystem. When TRUE, methods such as Untar, UntarGz, UntarBz2, and UntarZ scan the archive without producing extracted output. The default is FALSE.

Archive inventory workflow: Combine this property with CaptureXmlListing to obtain an XML listing without extracting the archive.

top
UntarCaseSensitive
BOOL CkTar_getUntarCaseSensitive(HCkTar cHandle);
void CkTar_putUntarCaseSensitive(HCkTar cHandle, BOOL newVal);

Deprecated. Use MatchCaseSensitive instead.

Until this property is removed, reading or setting it has the same effect as reading or setting MatchCaseSensitive.

top
UntarDebugLog
BOOL CkTar_getUntarDebugLog(HCkTar cHandle);
void CkTar_putUntarDebugLog(HCkTar cHandle, BOOL newVal);

Controls whether untar methods add per-entry extraction details to LastErrorText, LastErrorXml, and LastErrorHtml. The default is FALSE.

Diagnostic output is not necessarily an error: When this property is enabled, the LastError properties can contain useful extraction trace information even after a successful operation.

top
UntarDiscardPaths
BOOL CkTar_getUntarDiscardPaths(HCkTar cHandle);
void CkTar_putUntarDiscardPaths(HCkTar cHandle, BOOL newVal);

Controls whether directory components from archive entry names are discarded during extraction. When TRUE, each file is written directly into UntarFromDir rather than recreating the archived directory tree. The default is FALSE.

Filename collisions: Different archive entries can have the same final filename after their directory paths are removed. Use this option only when flattening the archive is intentional and potential collisions are acceptable.

top
UntarFromDir
void CkTar_getUntarFromDir(HCkTar cHandle, HCkString retval);
void CkTar_putUntarFromDir(HCkTar cHandle, const char *newVal);
const char *CkTar_untarFromDir(HCkTar cHandle);

Specifies the destination directory for extraction. The default is ., meaning the current working directory of the calling process.

When UntarDiscardPaths is FALSE, archived subdirectories are recreated beneath this directory. When it is TRUE, extracted files are placed directly in this directory.

Safer extraction: For untrusted archives, choose a new or otherwise isolated destination directory rather than extracting directly into an application or system directory.

top
UntarMaxCount
int CkTar_getUntarMaxCount(HCkTar cHandle);
void CkTar_putUntarMaxCount(HCkTar cHandle, int newVal);

Limits the number of matching entries extracted by an untar operation. The default is 0, which means no maximum.

For example, set MustMatch to select a particular path and set UntarMaxCount to 1 to stop after the first matching entry is extracted.

Archive order matters: When a limit is used, extraction stops after the configured number of matches in archive order.

top
UserId
int CkTar_getUserId(HCkTar cHandle);
void CkTar_putUserId(HCkTar cHandle, int newVal);

Specifies the numeric user identifier (UID) written to TAR headers when an archive is created. The default value is 1000.

Ownership metadata: A stored UID does not by itself change the owner of a local source file. Restoring ownership during extraction may require elevated privileges and may not apply on non-UNIX systems.

top
UserName
void CkTar_getUserName(HCkTar cHandle, HCkString retval);
void CkTar_putUserName(HCkTar cHandle, const char *newVal);
const char *CkTar_userName(HCkTar cHandle);

Specifies the user name written to TAR headers when an archive is created. By default, Chilkat uses the username of the account running the application.

Name versus numeric ID: TAR headers can contain both a user name and the numeric UserId. Their interpretation depends on the extracting tool and destination system.

top
Utf8
BOOL CkTar_getUtf8(HCkTar cHandle);
void CkTar_putUtf8(HCkTar cHandle, BOOL newVal);

When set to TRUE, all const char * arguments and return values are interpreted as UTF-8 strings. When set to FALSE, they are interpreted as ANSI strings.

In Chilkat v11.0.0 and later, the default value is TRUE. Before v11.0.0, it was FALSE.

top
VerboseLogging
BOOL CkTar_getVerboseLogging(HCkTar cHandle);
void CkTar_putVerboseLogging(HCkTar cHandle, BOOL newVal);

If set to TRUE, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is FALSE. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
void CkTar_getVersion(HCkTar cHandle, HCkString retval);
const char *CkTar_version(HCkTar cHandle);

Version of the component/library, such as "10.1.0"

More Information and Examples
top
WriteFormat
void CkTar_getWriteFormat(HCkTar cHandle, HCkString retval);
void CkTar_putWriteFormat(HCkTar cHandle, const char *newVal);
const char *CkTar_writeFormat(HCkTar cHandle);

Specifies the TAR header format used by the WriteTar* methods. The default is gnu. Supported values are:

ValueUse
gnuGNU TAR format and extensions. This is the Chilkat default and supports archive metadata beyond classic ustar limits.
paxPOSIX pax extended format. It is designed to represent long names and additional metadata through extensible records.
ustarPOSIX ustar format. It is broadly interoperable but has stricter limits on path lengths and metadata fields.
Choosing a format: Use ustar when compatibility with simple TAR readers is the priority and the archive fits its limits. Use pax for portable extended metadata, or retain gnu when GNU TAR compatibility is expected.

top
XmlListing
void CkTar_getXmlListing(HCkTar cHandle, HCkString retval);
void CkTar_putXmlListing(HCkTar cHandle, const char *newVal);
const char *CkTar_xmlListing(HCkTar cHandle);
Introduced in version 9.5.0.46

Contains the XML listing captured by the most recent untar operation for which CaptureXmlListing was TRUE. The XML structure is the same as the output from ListXml.

Read after the operation: Use the untar method's return value to confirm that the archive was processed successfully before consuming this property.

top

Methods

AddDirRoot
BOOL CkTar_AddDirRoot(HCkTar cHandle, const char *dirPath);

Adds the directory tree at dirPath to the set of sources used by the next WriteTar* operation. Call this method multiple times to include multiple directory trees in one archive.

Use AddDirRoot2 when the tree should appear beneath an explicit prefix inside the archive.

Queued archive sources: Directory roots and files are retained by the object until ClearDirRootsAndFiles is called.

Returns TRUE for success, FALSE for failure.

top
AddDirRoot2
BOOL CkTar_AddDirRoot2(HCkTar cHandle, const char *rootPrefix, const char *rootPath);
Introduced in version 9.5.0.56

Adds the directory tree at rootPath to the archive-creation source list and stores its entries beneath the archive prefix supplied in rootPrefix. Call this method multiple times, or combine it with AddDirRoot, before calling a WriteTar* method.

rootPrefix should be a relative archive path such as abc/123 and should not end with /. If DirPrefix is also set, DirPrefix is applied first.

Path composition example: With DirPrefix = "package" and rootPrefix = "assets", files from this root are stored beneath package/assets/.

Returns TRUE for success, FALSE for failure.

top
AddFile
BOOL CkTar_AddFile(HCkTar cHandle, const char *path);
Introduced in version 9.5.0.46

Adds the local file at path to the set of sources used by the next WriteTar* operation. Call AddFile, AddFile2, and the directory-root methods as needed before writing a single archive.

Use AddFile2 when the path stored inside the TAR must be specified independently of the source file path.

Queued archive sources: Added files and directory roots remain associated with the object until ClearDirRootsAndFiles is called.

Returns TRUE for success, FALSE for failure.

top
AddFile2
BOOL CkTar_AddFile2(HCkTar cHandle, const char *filePath, const char *pathWithinTar);
Introduced in version 9.5.0.69

Adds the local file at filePath to the archive-creation source list and stores it using the exact archive path supplied in pathWithinTar. This allows the source path and the path visible inside the TAR to differ.

Call this method as many times as needed, optionally together with the other file and directory-root methods, before calling a single WriteTar* method.

DirPrefix is not applied: Because pathWithinTar already specifies the path within the TAR, DirPrefix does not modify entries added by this method. Use forward slashes and a relative path for portable archive names.

Returns TRUE for success, FALSE for failure.

top
ClearDirRootsAndFiles
BOOL CkTar_ClearDirRootsAndFiles(HCkTar cHandle);
Introduced in version 9.5.0.84

Removes all files and directory roots previously registered by AddDirRoot, AddDirRoot2, AddFile, and AddFile2.

Call this method before building a different archive with the same Tar object when the earlier source list should not be reused.

Returns TRUE for success, FALSE for failure.

top
CreateDeb
BOOL CkTar_CreateDeb(HCkTar cHandle, const char *controlPath, const char *dataPath, const char *debPath);
Introduced in version 9.5.0.66

Creates a Debian binary package at debPath from the prepared control archive at controlPath and data archive at dataPath. The inputs are typically named control.tar.gz and data.tar.gz, or use another compression form accepted by the target Debian tooling.

Debian package structure: A modern .deb file is an ar archive containing a debian-binary format marker, a control.tar.* member for package metadata and maintainer scripts, and a data.tar.* member for the installed filesystem payload.
Prepared inputs required: This method packages the supplied control and data tarballs. The caller is responsible for making their directory layout, control metadata, permissions, and package contents valid for Debian package-management tools.

Returns TRUE for success, FALSE for failure.

top
GetDirRoot
BOOL CkTar_GetDirRoot(HCkTar cHandle, int index, HCkString outStr);
const char *CkTar_getDirRoot(HCkTar cHandle, int index);

Returns a directory root previously added with AddDirRoot or AddDirRoot2. index is a zero-based index.

Valid indexes range from 0 through NumDirRoots - 1. For example, after two roots are added, GetDirRoot(0) returns the first and GetDirRoot(1) returns the second.

Returns TRUE for success, FALSE for failure.

top
ListXml
BOOL CkTar_ListXml(HCkTar cHandle, const char *tarPath, HCkString outStr);
const char *CkTar_listXml(HCkTar cHandle, const char *tarPath);

Scans the uncompressed TAR archive at tarPath and returns an XML description of its files, directories, and archive metadata. The archive is not extracted.

Compressed tarballs: For a compressed TAR archive, an untar method can capture the same listing format by setting CaptureXmlListing. Set SuppressOutput as well when no files should be written.

Returns TRUE for success, FALSE for failure.

top
ListXmlAsync (1)
HCkTask CkTar_ListXmlAsync(HCkTar cHandle, const char *tarPath);

Creates an asynchronous task to call the ListXml method with the arguments provided.

Returns NULL on failure

top
LoadTaskCaller
BOOL CkTar_LoadTaskCaller(HCkTar cHandle, HCkTask task);
Introduced in version 9.5.0.80

Loads the caller object associated with task, an asynchronous Chilkat Task, into this Tar object.

Specialized async support: This method supports Chilkat task-caller plumbing and is not normally needed in ordinary archive code. Use it only when a Chilkat example or support instruction specifically requires it.

Returns TRUE for success, FALSE for failure.

top
Untar
int CkTar_Untar(HCkTar cHandle, const char *tarPath);

Extracts the uncompressed TAR archive at tarPath into the directory specified by UntarFromDir. Archived directory trees are recreated unless UntarDiscardPaths is TRUE.

Returns the number of files and directories extracted, or -1 if the operation fails. Extraction is also affected by the matching, path-safety, count-limit, listing, and output-suppression properties of this object.

TAR is a container format: An ordinary .tar archive is not compressed. Use UntarGz, UntarBz2, or UntarZ for the corresponding compressed tarball formats.
More Information and Examples
top
UntarAsync (1)
HCkTask CkTar_UntarAsync(HCkTar cHandle, const char *tarPath);

Creates an asynchronous task to call the Untar method with the arguments provided.

Returns NULL on failure

top
UntarBz2
BOOL CkTar_UntarBz2(HCkTar cHandle, const char *tarPath);

Decompresses and extracts the .tar.bz2 archive at tarPath into UntarFromDir. This format is also commonly named .tbz, .tbz2, or .tb2.

Returns TRUE on success and FALSE on failure. The same extraction filters, path controls, listing options, and output settings used by Untar also apply.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
UntarBz2Async (1)
HCkTask CkTar_UntarBz2Async(HCkTar cHandle, const char *tarPath);

Creates an asynchronous task to call the UntarBz2 method with the arguments provided.

Returns NULL on failure

top
UntarFirstMatchingToBd
BOOL CkTar_UntarFirstMatchingToBd(HCkTar cHandle, const char *tarPath, const char *matchPattern, HCkBinData bd);
Introduced in version 9.5.0.82

Scans the uncompressed TAR archive at tarPath and copies the contents of the first file whose archive path matches matchPattern into the BinData object supplied in bd. Matching is evaluated in archive order.

No archive entry is written to the local filesystem. Returns TRUE when a matching file is successfully extracted to bd and FALSE otherwise.

Returns TRUE for success, FALSE for failure.

top
UntarGz
BOOL CkTar_UntarGz(HCkTar cHandle, const char *tarPath);

Decompresses and extracts the .tar.gz archive at tarPath into UntarFromDir. The .tgz extension is a common short form for the same gzip-compressed TAR structure.

Returns TRUE on success and FALSE on failure. The same extraction filters, path controls, listing options, and output settings used by Untar also apply.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
UntarGzAsync (1)
HCkTask CkTar_UntarGzAsync(HCkTar cHandle, const char *tarPath);

Creates an asynchronous task to call the UntarGz method with the arguments provided.

Returns NULL on failure

top
UntarZ
BOOL CkTar_UntarZ(HCkTar cHandle, const char *tarPath);

Decompresses and extracts the .tar.Z archive at tarPath into UntarFromDir. The .Z suffix denotes the historical UNIX compress format; .taz is a common alternate extension.

Returns TRUE on success and FALSE on failure. The same extraction filters, path controls, listing options, and output settings used by Untar also apply.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
UntarZAsync (1)
HCkTask CkTar_UntarZAsync(HCkTar cHandle, const char *tarPath);

Creates an asynchronous task to call the UntarZ method with the arguments provided.

Returns NULL on failure

top
VerifyTar
BOOL CkTar_VerifyTar(HCkTar cHandle, const char *tarPath);

Opens the uncompressed TAR archive at tarPath and scans its headers through the end of the archive. Returns TRUE when the archive structure is accepted and no TAR-format errors are found; otherwise returns FALSE.

What verification does not establish: Structural verification does not prove that archived files are safe, trustworthy, or appropriate to extract. It is not malware scanning and does not authenticate the archive publisher.
top
VerifyTarAsync (1)
HCkTask CkTar_VerifyTarAsync(HCkTar cHandle, const char *tarPath);

Creates an asynchronous task to call the VerifyTar method with the arguments provided.

Returns NULL on failure

top
WriteTar
BOOL CkTar_WriteTar(HCkTar cHandle, const char *tarPath);

Creates an uncompressed TAR archive at tarPath from the files and directory trees previously added with AddFile, AddFile2, AddDirRoot, and AddDirRoot2. Archive paths, permissions, ownership metadata, filters, and header format are controlled by the corresponding properties.

Returns TRUE on success and FALSE on failure.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
WriteTarAsync (1)
HCkTask CkTar_WriteTarAsync(HCkTar cHandle, const char *tarPath);

Creates an asynchronous task to call the WriteTar method with the arguments provided.

Returns NULL on failure

top
WriteTarBz2
BOOL CkTar_WriteTarBz2(HCkTar cHandle, const char *bz2Path);

Creates a bzip2-compressed TAR archive at bz2Path from the files and directory trees previously added to this object. Common filename extensions include .tar.bz2, .tbz, .tbz2, and .tb2.

Returns TRUE on success and FALSE on failure.

Two-layer format: The result is a TAR byte stream compressed with bzip2. TAR supplies the multi-file archive structure; bzip2 supplies compression.

Returns TRUE for success, FALSE for failure.

top
WriteTarBz2Async (1)
HCkTask CkTar_WriteTarBz2Async(HCkTar cHandle, const char *bz2Path);

Creates an asynchronous task to call the WriteTarBz2 method with the arguments provided.

Returns NULL on failure

top
WriteTarGz
BOOL CkTar_WriteTarGz(HCkTar cHandle, const char *gzPath);

Creates a gzip-compressed TAR archive at gzPath from the files and directory trees previously added to this object. The usual extensions are .tar.gz and .tgz.

Returns TRUE on success and FALSE on failure.

Two-layer format: The result is a TAR byte stream compressed with gzip. TAR supplies the multi-file archive structure; gzip supplies compression.

Returns TRUE for success, FALSE for failure.

More Information and Examples
top
WriteTarGzAsync (1)
HCkTask CkTar_WriteTarGzAsync(HCkTar cHandle, const char *gzPath);

Creates an asynchronous task to call the WriteTarGz method with the arguments provided.

Returns NULL on failure

top

Deprecated

UntarFirstMatchingToMemory Deprecated
BOOL CkTar_UntarFirstMatchingToMemory(HCkTar cHandle, HCkByteData tarFileBytes, const char *matchPattern, HCkByteData outBytes);

Reads an in-memory, uncompressed TAR archive from tarFileBytes and returns the contents of the first file whose archive path matches matchPattern. Matching is evaluated in archive order.

No file is written to the local filesystem. Use the normal method-success indicator and LastErrorText to distinguish a successful result from a missing match or processing failure.

Returns TRUE for success, FALSE for failure.

top
UntarFromMemory Deprecated
int CkTar_UntarFromMemory(HCkTar cHandle, HCkByteData tarFileBytes);

Extracts an uncompressed TAR archive supplied as bytes in tarFileBytes. Files and directories are written beneath UntarFromDir, subject to the same filters and path options as Untar.

Returns the number of files and directories extracted, or -1 on failure.

top
UntarFromMemoryAsync Deprecated (1)
HCkTask CkTar_UntarFromMemoryAsync(HCkTar cHandle, HCkByteData tarFileBytes);

Creates an asynchronous task to call the UntarFromMemory method with the arguments provided.

Returns NULL on failure

top