function drush_save_data_to_temp_file

8.0.x filesystem.inc drush_save_data_to_temp_file($data, $suffix = NULL)
6.x filesystem.inc drush_save_data_to_temp_file($data, $suffix = NULL)
7.x filesystem.inc drush_save_data_to_temp_file($data, $suffix = NULL)
3.x drush.inc drush_save_data_to_temp_file($data)
4.x drush.inc drush_save_data_to_temp_file($data)
5.x filesystem.inc drush_save_data_to_temp_file($data, $suffix = NULL)
master filesystem.inc drush_save_data_to_temp_file($data, $suffix = NULL)

Save a string to a temporary file. Does not depend on Drupal's API. The temporary file will be automatically deleted when drush exits.

Parameters

string $data:

Return value

string A path to the file.

2 calls to drush_save_data_to_temp_file()
drush_core_cli in commands/core/core.drush.inc
_drush_sql_query in commands/sql/sql.drush.inc

File

includes/drush.inc, line 434
The drush API implementation and helpers.

Code

function drush_save_data_to_temp_file($data) {
  static $fp;

  $fp = tmpfile();
  fwrite($fp, $data);
  $meta_data = stream_get_meta_data($fp);
  $file = $meta_data['uri'];
  drush_register_file_for_deletion($file);

  return $file;
}