#include <userver/fs/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 25 of file temp_file.hpp.
|
| TempFile (TempFile &&other) noexcept=default |
|
TempFile & | operator= (TempFile &&other) noexcept=default |
|
const std::string & | GetPath () const |
| The file path.
|
|
void | Remove () && |
| Remove the file early.
|
|
|
static TempFile | Create (engine::TaskProcessor &fs_task_processor) |
| Create the file at the default path for temporary files.
|
|
static TempFile | Create (std::string_view parent_path, std::string_view name_prefix, engine::TaskProcessor &fs_task_processor) |
| Create the file at the specified path.
|
|
static TempFile | Adopt (std::string path, engine::TaskProcessor &fs_task_processor) |
| Take ownership of an existing file.
|
|
◆ Create() [1/2]
static TempFile fs::TempFile::Create |
( |
engine::TaskProcessor & | fs_task_processor | ) |
|
|
static |
Create the file at the default path for temporary files.
- Exceptions
-
◆ Create() [2/2]
static TempFile fs::TempFile::Create |
( |
std::string_view | parent_path, |
|
|
std::string_view | name_prefix, |
|
|
engine::TaskProcessor & | fs_task_processor ) |
|
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::TempFile::Remove |
( |
| ) |
&& |
Remove the file early.
- Exceptions
-
The documentation for this class was generated from the following file: