Chilkat C# Tar Class Reference
Tar
API for creating and extracting TAR archives. Also supports creating and extracting .tar.gz (.tgz), .tar.bz2, and .tar.Z (compressed TAR archives, also known as compressed tarball archives). Can read/write the following TAR formats: (1) GNU tar 1.13.x format, (2) PAX -- POSIX 1003.1-2001 format, (3) USTAR -- POSIX 1003.1-1988 format.
Object Creation
(C#)
Chilkat.Tar obj = new Chilkat.Tar();
(VB.NET)
Dim obj As New Chilkat.Tar()
Properties
public string Charset {get; set; }
Character encoding to be used when interpreting filenames within .tar archives for untar operations. The default is "utf-8", and this is typically not changed. (The WriteTar methods always uses utf-8 to store filenames within the TAR archive.)
public int DirMode {get; set; }
The directory permissions to used in WriteTar* methods. The default is octal 0755. This is the value to be stored in the "mode" field of each TAR header for a directory entries.
public string DirPrefix {get; set; }
To be documented soon...
public bool EnableEvents {get; set; }
This property must be set to true to enable event callbacks. By default, it is false.
public int FileMode {get; set; }
The file permissions to used in WriteTar* methods. The default is octal 0644. This is the value to be stored in the "mode" field of each TAR header for a file entries.
public int GroupId {get; set; }
The default numerical GID to be stored in each TAR header when writing TAR archives. The default value is 1000.
public string GroupName {get; set; }
The default group name to be stored in each TAR header when writing TAR archives. The default value is the logged-on username of the application's process.
public int HeartbeatMs {get; set; }
This is the number of milliseconds between each AbortCheck event callback. The AbortCheck callback allows an application to abort any TAR operation prior to completion. If HeartbeatMs is 0, no AbortCheck event callbacks will occur.
public string LastErrorHtml {get; }
Error information in HTML format for the last method called.
public string LastErrorText {get; }
To be documented soon.Error information in plain-text format for the last method called.
public string LastErrorXml {get; }
To be documented soon.Error information in XML format for the last method called.
public bool NoAbsolutePaths {get; set; }
If true, then absolute paths are converted to relative paths by removing the leading "/" or "\" character when untarring. This protects your system from unknowingly untarring files into important system directories, such as C:\Windows\system32. The default value is true.
public int NumDirRoots {get; }
The total number of directory roots set by calling AddDirRoot (i.e. the number of times AddDirRoot was called by the application). A TAR archive is created by calling AddDirRoot for one or more directory tree roots, followed by a single call to WriteTar (or WriteTarBz2, WriteTarGz, WriteTarZ). This allows for TAR archives containing multiple directory trees to be created.
public int ScriptFileMode {get; set; }
The file permissions to used in WriteTar* methods for shell script files (.sh, .csh, .bash, .bsh). The default is octal 0755. This is the value to be stored in the "mode" field of each TAR header for a file entries.
public bool UntarCaseSensitive {get; set; }
Determines whether pattern matching is case-sensitive if the UntarMatchPattern is used. The default value is false.
public bool UntarDebugLog {get; set; }
Similar to the VerboseLogging property. If set to true, then information about each file/directory extracted in an untar method call is logged to LastErrorText (or LastErrorXml / LastErrorHtml). The default value is false.
public bool UntarDiscardPaths {get; set; }
If true, then discard all path information when untarring. This causes all files to be untarred into a single directory. The default value is false.
public string UntarFromDir {get; set; }
The directory path where files are extracted when untarring. The default value is ".", meaning that the current working directory of the calling process is used. If UntarDiscardPaths is set, then all files are untarred into this directory. Otherwise, the untar operation will re-create a directory tree rooted in this directory.
public string UntarMatchPattern {get; set; }
Used to untar only files and directories that match this pattern. The asterisk character represents 0 or more of any character. For example, setting this pattern to "*.txt" causes all .txt files to be extracted. The default value is an empty string, indicating that all files are to be extracted.
public int UntarMaxCount {get; set; }
Limits the number of files extracted during an untar to this count. The default value is 0 to indicate no maximum. To untar a single file, one might set the UntarMatchPattern such that it will match only the file to be extracted, and also set UntarMaxCount equal to 1. This causes an untar to scan the TAR archive until it finds the matching file, extract it, and then return.
public int UserId {get; set; }
The default numerical UID to be stored in each TAR header when writing TAR archives. The default value is 1000.
public string UserName {get; set; }
The default user name to be stored in each TAR header when writing TAR archives. The default value is the logged-on username of the application's process.
public bool VerboseLogging {get; set; }
If set to true, then the LastErrorText may contain more verbose logging.
public string WriteFormat {get; set; }
The TAR format to use when writing a TAR archive. Valid values are "gnu", "pax", and "ustar". The default value is "gnu".
Methods
public bool AddDirRoot(string dirPath);
Adds a directory tree to be included in the next call to one of the WriteTar* methods. To include multiple directory trees in a .tar, call AddDirRoot multiple times followed by a single call to WriteTar. Returns true for success, false for failure.
public string GetDirRoot(int index);
Returns the value of the Nth directory root. For example, if an application calls AddDirRoot twice, then the NumDirRoots property would have a value of 2, and GetDirRoot(0) would return the path passed to AddDirRoot in the 1st call, and GetDirRoot(1) would return the directory path in the 2nd call to AddDirRoot. Returns a null on failure
public string ListXml(string tarFilename);
Scans a TAR archive and returns XML detailing the files and directories found within the TAR. Returns a null on failure
public bool SaveLastError(string filename);
Saves the last error information to an XML formatted file.
public bool UnlockComponent(string unlockCode);
Unlocks the component allowing for the full functionality to be used. If this method unexpectedly returns false, examine the contents of the LastErrorText property to determine the reason for failure.
public int Untar(string tarFilename);
Extracts the files and directories from a TAR archive, reconstructing the directory tree(s) in the local filesystem. The files are extracted to the directory specified by the UntarFromDir property. Returns the number of files and directories extracted, or -1 for failure. (C#) Untar a .tar Archive (PowerShell) Untar a .tar Archive
public bool UntarBz2(string tarFilename);
Extracts the files and directories from a tar.bz2 (or tar.bzip2) archive, reconstructing the directory tree(s) in the local filesystem. The files are extracted to the directory specified by the UntarFromDir property. Returns true for success, false for failure. (C#) Untar a .tar.bz2 Compressed Archive (PowerShell) Untar a .tar.bz2 Compressed Archive
public byte[] UntarFirstMatchingToMemory(byte[] tarFileBytes, string matchPattern);
Memory-to-memory untar. The first file matching the UntarMatchPattern property is extracted and returned. Returns an empty byte array on failure
public int UntarFromMemory(byte[] tarFileBytes);
Extracts the files and directories from an in-memory TAR archive, reconstructing the directory tree(s) in the local filesystem. The files are extracted to the directory specified by the UntarFromDir property. Returns the number of files and directories extracted, or -1 for failure.
public bool UntarGz(string tarFilename);
Extracts the files and directories from a tar.gz (or tar.gzip) archive, reconstructing the directory tree(s) in the local filesystem. The files are extracted to the directory specified by the UntarFromDir property. Returns true for success, false for failure. (C#) Untar a .tar.gz (.tgz) Compressed Archive (PowerShell) Untar a .tar.gz (.tgz) Compressed Archive
public bool UntarZ(string tarFilename);
Extracts the files and directories from a tar.Z archive, reconstructing the directory tree(s) in the local filesystem. The files are extracted to the directory specified by the UntarFromDir property. Returns true for success, false for failure. (C#) Untar a .tar.Z (.taz) Compressed Archive (PowerShell) Untar a .tar.Z (.taz) Compressed Archive
public bool VerifyTar(string tarFilename);
To be documented soon...
public bool WriteTar(string tarFilename);
Writes a TAR archive. The directory trees previously added by calling AddDirRoot one or more times are included in the output TAR archive. Returns true for success, false for failure. (C#) Create TAR Archive (PowerShell) Create TAR Archive
public bool WriteTarBz2(string outFilename);
Writes a .tar.bz2 compressed TAR archive. The directory trees previously added by calling AddDirRoot one or more times are included in the output file. Returns true for success, false for failure. (C#) Create TAR BZ2 Compressed Archive (.tar.bz2, .tbz, .tbz2, .tb2) (PowerShell) Create TAR BZ2 Compressed Archive (.tar.bz2, .tbz, .tbz2, .tb2)
public bool WriteTarGz(string outFilename);
Writes a .tar.gz (also known as .tgz) compressed TAR archive. The directory trees previously added by calling AddDirRoot one or more times are included in the output file. Returns true for success, false for failure. (C#) Create Compressed .tgz (.tar.gz) TAR Archive (PowerShell) Create Compressed .tgz (.tar.gz) TAR Archive
|