9#include <userver/utils/boost_filesystem_file_status.hpp>
11#include <userver/fs/blocking/open_mode.hpp>
13USERVER_NAMESPACE_BEGIN
22class FileDescriptor
final {
26 static FileDescriptor
Open(
27 const std::string& path,
29 boost::filesystem::perms perms = boost::filesystem::perms::owner_read | boost::filesystem::perms::owner_write
38 static FileDescriptor
AdoptFd(
int fd)
noexcept;
40 FileDescriptor() =
delete;
41 FileDescriptor(FileDescriptor&& other)
noexcept;
42 FileDescriptor& operator=(FileDescriptor&& other)
noexcept;
63 void Write(std::string_view contents);
69 std::size_t
Read(
char* buffer, std::size_t max_size);
73 void Seek(std::size_t offset_in_bytes);
84 explicit FileDescriptor(
int fd);
86 friend class TempFile;