Function __global->tar_get_file

Definitions

sources/tar.php

  • Get the contents of the specified file in the specified TAR.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
&$resource array Yes No required parameter N/A N/A The TAR file handle
$path PATH No No required parameter N/A N/A The full path to the file we want to get
$tolerate_errors boolean No No False N/A N/A Whether to tolerate errors (returns null if error)
$write_data_to ?PATH No No Null N/A N/A Write data to here (null: return within array)

Returns

  • A map, containing 'data' (the file), 'size' (the filesize), 'mtime' (the modification timestamp), and 'mode' (the permissions) (null: not found / TAR possibly corrupt if we turned tolerate errors on)
  • Type: ?array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get the contents of the specified file in the specified TAR.
 *
 * @param  array $resource The TAR file handle
 * @param  PATH $path The full path to the file we want to get
 * @param  boolean $tolerate_errors Whether to tolerate errors (returns null if error)
 * @param  ?PATH $write_data_to Write data to here (null: return within array)
 * @return ?array A map, containing 'data' (the file), 'size' (the filesize), 'mtime' (the modification timestamp), and 'mode' (the permissions) (null: not found / TAR possibly corrupt if we turned tolerate errors on)
 */

function tar_get_file(array &$resource, string $path, bool $tolerate_errors = false, ?string $write_data_to = null) : ?array