#include <userver/fs/blocking/temp_file.hpp>
A unique temporary file. The file is deleted when the TempFile object is destroyed. 
- Note
 - The file has permissions=0600. Any newly created parent directories have permissions=0700. 
 
- 
The newly created file is immediately opened with read-write permissions. The file descriptor can be accessed using 
File.  
Definition at line 21 of file temp_file.hpp.
 | 
| 
  | TempFile (TempFile &&other) noexcept | 
|   | 
| 
TempFile &  | operator= (TempFile &&other) noexcept | 
|   | 
| 
const std::string &  | GetPath () const | 
|   | The file path. 
  | 
|   | 
| void  | Remove () && | 
|   | Remove the file early.  
  | 
|   | 
 | 
| static TempFile  | Create () | 
|   | Create the file at the default path for temporary files.  
  | 
|   | 
| static TempFile  | Create (std::string_view parent_path, std::string_view name_prefix) | 
|   | Create the file at the specified path.  
  | 
|   | 
| 
static TempFile  | Adopt (std::string path) | 
|   | Take ownership of an existing file. 
  | 
|   | 
◆ Create() [1/2]
  
  
      
        
          | static TempFile fs::blocking::TempFile::Create  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
static   | 
  
 
Create the file at the default path for temporary files. 
- Exceptions
 - 
  
  
 
 
 
◆ Create() [2/2]
  
  
      
        
          | static TempFile fs::blocking::TempFile::Create  | 
          ( | 
          std::string_view |           parent_path,  | 
         
        
           | 
           | 
          std::string_view |           name_prefix ) | 
         
       
   | 
  
static   | 
  
 
Create the file at the specified path. 
- Parameters
 - 
  
    | parent_path | The directory where the temporary file will be created  | 
    | name_prefix | File name prefix, a random string will be added after the prefix  | 
  
   
- Exceptions
 - 
  
  
 
 
 
◆ Remove()
      
        
          | void fs::blocking::TempFile::Remove  | 
          ( | 
           | ) | 
           && | 
        
      
 
Remove the file early. 
- Exceptions
 - 
  
  
 
 
 
The documentation for this class was generated from the following file: