| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="tar-examples.html" /> |
| 13 | <link rel="prev" href="tarfile-objects.html" /> |
| 14 | <link rel="parent" href="module-tarfile.html" /> |
| 15 | <link rel="next" href="tar-examples.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>7.19.2 TarInfo Objects </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="7.19.1 TarFile Objects" |
| 25 | href="tarfile-objects.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="7.19 tarfile " |
| 28 | href="module-tarfile.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="7.19.3 Examples" |
| 31 | href="tar-examples.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="tarfile-objects.html">7.19.1 TarFile Objects</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-tarfile.html">7.19 tarfile </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="tar-examples.html">7.19.3 Examples</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION0091920000000000000000"></A><A NAME="tarinfo-objects"></A> |
| 56 | <BR> |
| 57 | 7.19.2 TarInfo Objects |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | A <tt class="class">TarInfo</tt> object represents one member in a |
| 62 | <tt class="class">TarFile</tt>. Aside from storing all required attributes of a file |
| 63 | (like file type, size, time, permissions, owner etc.), it provides |
| 64 | some useful methods to determine its type. It does <em>not</em> contain |
| 65 | the file's data itself. |
| 66 | |
| 67 | <P> |
| 68 | <tt class="class">TarInfo</tt> objects are returned by <tt class="class">TarFile</tt>'s methods |
| 69 | <tt class="method">getmember()</tt>, <tt class="method">getmembers()</tt> and <tt class="method">gettarinfo()</tt>. |
| 70 | |
| 71 | <P> |
| 72 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 73 | <td><nobr><b><span class="typelabel">class</span> <tt id='l2h-2918' xml:id='l2h-2918' class="class">TarInfo</tt></b>(</nobr></td> |
| 74 | <td><var></var><big>[</big><var>name</var><big>]</big><var></var>)</td></tr></table></dt> |
| 75 | <dd> |
| 76 | Create a <tt class="class">TarInfo</tt> object. |
| 77 | </dl> |
| 78 | |
| 79 | <P> |
| 80 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 81 | <td><nobr><b><tt id='l2h-2919' xml:id='l2h-2919' class="method">frombuf</tt></b>(</nobr></td> |
| 82 | <td><var></var>)</td></tr></table></dt> |
| 83 | <dd> |
| 84 | Create and return a <tt class="class">TarInfo</tt> object from a string buffer. |
| 85 | </dl> |
| 86 | |
| 87 | <P> |
| 88 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 89 | <td><nobr><b><tt id='l2h-2920' xml:id='l2h-2920' class="method">tobuf</tt></b>(</nobr></td> |
| 90 | <td><var></var>)</td></tr></table></dt> |
| 91 | <dd> |
| 92 | Create a string buffer from a <tt class="class">TarInfo</tt> object. |
| 93 | </dl> |
| 94 | |
| 95 | <P> |
| 96 | A <code>TarInfo</code> object has the following public data attributes: |
| 97 | |
| 98 | <P> |
| 99 | <dl><dt><b><tt id='l2h-2921' xml:id='l2h-2921' class="member">name</tt></b></dt> |
| 100 | <dd> |
| 101 | Name of the archive member. |
| 102 | </dl> |
| 103 | |
| 104 | <P> |
| 105 | <dl><dt><b><tt id='l2h-2922' xml:id='l2h-2922' class="member">size</tt></b></dt> |
| 106 | <dd> |
| 107 | Size in bytes. |
| 108 | </dl> |
| 109 | |
| 110 | <P> |
| 111 | <dl><dt><b><tt id='l2h-2923' xml:id='l2h-2923' class="member">mtime</tt></b></dt> |
| 112 | <dd> |
| 113 | Time of last modification. |
| 114 | </dl> |
| 115 | |
| 116 | <P> |
| 117 | <dl><dt><b><tt id='l2h-2924' xml:id='l2h-2924' class="member">mode</tt></b></dt> |
| 118 | <dd> |
| 119 | Permission bits. |
| 120 | </dl> |
| 121 | |
| 122 | <P> |
| 123 | <dl><dt><b><tt id='l2h-2925' xml:id='l2h-2925' class="member">type</tt></b></dt> |
| 124 | <dd> |
| 125 | File type. <var>type</var> is usually one of these constants: |
| 126 | <tt class="constant">REGTYPE</tt>, <tt class="constant">AREGTYPE</tt>, <tt class="constant">LNKTYPE</tt>, |
| 127 | <tt class="constant">SYMTYPE</tt>, <tt class="constant">DIRTYPE</tt>, <tt class="constant">FIFOTYPE</tt>, |
| 128 | <tt class="constant">CONTTYPE</tt>, <tt class="constant">CHRTYPE</tt>, <tt class="constant">BLKTYPE</tt>, |
| 129 | <tt class="constant">GNUTYPE_SPARSE</tt>. To determine the type of a |
| 130 | <tt class="class">TarInfo</tt> object more conveniently, use the <code>is_*()</code> |
| 131 | methods below. |
| 132 | </dl> |
| 133 | |
| 134 | <P> |
| 135 | <dl><dt><b><tt id='l2h-2926' xml:id='l2h-2926' class="member">linkname</tt></b></dt> |
| 136 | <dd> |
| 137 | Name of the target file name, which is only present in |
| 138 | <tt class="class">TarInfo</tt> objects of type <tt class="constant">LNKTYPE</tt> and |
| 139 | <tt class="constant">SYMTYPE</tt>. |
| 140 | </dl> |
| 141 | |
| 142 | <P> |
| 143 | <dl><dt><b><tt id='l2h-2927' xml:id='l2h-2927' class="member">uid</tt></b></dt> |
| 144 | <dd> |
| 145 | User ID of the user who originally stored this member. |
| 146 | </dl> |
| 147 | |
| 148 | <P> |
| 149 | <dl><dt><b><tt id='l2h-2928' xml:id='l2h-2928' class="member">gid</tt></b></dt> |
| 150 | <dd> |
| 151 | Group ID of the user who originally stored this member. |
| 152 | </dl> |
| 153 | |
| 154 | <P> |
| 155 | <dl><dt><b><tt id='l2h-2929' xml:id='l2h-2929' class="member">uname</tt></b></dt> |
| 156 | <dd> |
| 157 | User name. |
| 158 | </dl> |
| 159 | |
| 160 | <P> |
| 161 | <dl><dt><b><tt id='l2h-2930' xml:id='l2h-2930' class="member">gname</tt></b></dt> |
| 162 | <dd> |
| 163 | Group name. |
| 164 | </dl> |
| 165 | |
| 166 | <P> |
| 167 | A <tt class="class">TarInfo</tt> object also provides some convenient query methods: |
| 168 | |
| 169 | <P> |
| 170 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 171 | <td><nobr><b><tt id='l2h-2931' xml:id='l2h-2931' class="method">isfile</tt></b>(</nobr></td> |
| 172 | <td><var></var>)</td></tr></table></dt> |
| 173 | <dd> |
| 174 | Return <tt class="constant">True</tt> if the <tt class="class">Tarinfo</tt> object is a regular |
| 175 | file. |
| 176 | </dl> |
| 177 | |
| 178 | <P> |
| 179 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 180 | <td><nobr><b><tt id='l2h-2932' xml:id='l2h-2932' class="method">isreg</tt></b>(</nobr></td> |
| 181 | <td><var></var>)</td></tr></table></dt> |
| 182 | <dd> |
| 183 | Same as <tt class="method">isfile()</tt>. |
| 184 | </dl> |
| 185 | |
| 186 | <P> |
| 187 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 188 | <td><nobr><b><tt id='l2h-2933' xml:id='l2h-2933' class="method">isdir</tt></b>(</nobr></td> |
| 189 | <td><var></var>)</td></tr></table></dt> |
| 190 | <dd> |
| 191 | Return <tt class="constant">True</tt> if it is a directory. |
| 192 | </dl> |
| 193 | |
| 194 | <P> |
| 195 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 196 | <td><nobr><b><tt id='l2h-2934' xml:id='l2h-2934' class="method">issym</tt></b>(</nobr></td> |
| 197 | <td><var></var>)</td></tr></table></dt> |
| 198 | <dd> |
| 199 | Return <tt class="constant">True</tt> if it is a symbolic link. |
| 200 | </dl> |
| 201 | |
| 202 | <P> |
| 203 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 204 | <td><nobr><b><tt id='l2h-2935' xml:id='l2h-2935' class="method">islnk</tt></b>(</nobr></td> |
| 205 | <td><var></var>)</td></tr></table></dt> |
| 206 | <dd> |
| 207 | Return <tt class="constant">True</tt> if it is a hard link. |
| 208 | </dl> |
| 209 | |
| 210 | <P> |
| 211 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 212 | <td><nobr><b><tt id='l2h-2936' xml:id='l2h-2936' class="method">ischr</tt></b>(</nobr></td> |
| 213 | <td><var></var>)</td></tr></table></dt> |
| 214 | <dd> |
| 215 | Return <tt class="constant">True</tt> if it is a character device. |
| 216 | </dl> |
| 217 | |
| 218 | <P> |
| 219 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 220 | <td><nobr><b><tt id='l2h-2937' xml:id='l2h-2937' class="method">isblk</tt></b>(</nobr></td> |
| 221 | <td><var></var>)</td></tr></table></dt> |
| 222 | <dd> |
| 223 | Return <tt class="constant">True</tt> if it is a block device. |
| 224 | </dl> |
| 225 | |
| 226 | <P> |
| 227 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 228 | <td><nobr><b><tt id='l2h-2938' xml:id='l2h-2938' class="method">isfifo</tt></b>(</nobr></td> |
| 229 | <td><var></var>)</td></tr></table></dt> |
| 230 | <dd> |
| 231 | Return <tt class="constant">True</tt> if it is a FIFO. |
| 232 | </dl> |
| 233 | |
| 234 | <P> |
| 235 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 236 | <td><nobr><b><tt id='l2h-2939' xml:id='l2h-2939' class="method">isdev</tt></b>(</nobr></td> |
| 237 | <td><var></var>)</td></tr></table></dt> |
| 238 | <dd> |
| 239 | Return <tt class="constant">True</tt> if it is one of character device, block |
| 240 | device or FIFO. |
| 241 | </dl> |
| 242 | |
| 243 | <P> |
| 244 | |
| 245 | <DIV CLASS="navigation"> |
| 246 | <div class='online-navigation'> |
| 247 | <p></p><hr /> |
| 248 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 249 | <tr> |
| 250 | <td class='online-navigation'><a rel="prev" title="7.19.1 TarFile Objects" |
| 251 | href="tarfile-objects.html"><img src='../icons/previous.png' |
| 252 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 253 | <td class='online-navigation'><a rel="parent" title="7.19 tarfile " |
| 254 | href="module-tarfile.html"><img src='../icons/up.png' |
| 255 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 256 | <td class='online-navigation'><a rel="next" title="7.19.3 Examples" |
| 257 | href="tar-examples.html"><img src='../icons/next.png' |
| 258 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 259 | <td align="center" width="100%">Python Library Reference</td> |
| 260 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 261 | href="contents.html"><img src='../icons/contents.png' |
| 262 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 263 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 264 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 265 | <td class='online-navigation'><a rel="index" title="Index" |
| 266 | href="genindex.html"><img src='../icons/index.png' |
| 267 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 268 | </tr></table> |
| 269 | <div class='online-navigation'> |
| 270 | <b class="navlabel">Previous:</b> |
| 271 | <a class="sectref" rel="prev" href="tarfile-objects.html">7.19.1 TarFile Objects</A> |
| 272 | <b class="navlabel">Up:</b> |
| 273 | <a class="sectref" rel="parent" href="module-tarfile.html">7.19 tarfile </A> |
| 274 | <b class="navlabel">Next:</b> |
| 275 | <a class="sectref" rel="next" href="tar-examples.html">7.19.3 Examples</A> |
| 276 | </div> |
| 277 | </div> |
| 278 | <hr /> |
| 279 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 280 | </DIV> |
| 281 | <!--End of Navigation Panel--> |
| 282 | <ADDRESS> |
| 283 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 284 | </ADDRESS> |
| 285 | </BODY> |
| 286 | </HTML> |