Seastar
High performance C++ framework for concurrent servers
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Functions
File and Stream Utilities

Detailed Description

These utilities are provided to help perform operations on files and I/O streams.

Functions

template<typename Func >
requires std::invocable<Func, input_stream<char>&>
futurize< typenamestd::invoke_result_t< Func, input_stream< char > & > >::type seastar::util::with_file_input_stream (const std::filesystem::path &path, Func func, file_open_options file_opts={}, file_input_stream_options input_stream_opts={})
 
future< std::vector< temporary_buffer< char > > > seastar::util::read_entire_file (std::filesystem::path path)
 
future< sstring > seastar::util::read_entire_file_contiguous (std::filesystem::path path)
 

Function Documentation

◆ read_entire_file()

future< std::vector< temporary_buffer< char > > > seastar::util::read_entire_file ( std::filesystem::path  path)

Returns all bytes from the file until eof, accessible in chunks.

Note
use only on short files to avoid running out of memory.
Parameters
pathpath of the file to be read.

◆ read_entire_file_contiguous()

future< sstring > seastar::util::read_entire_file_contiguous ( std::filesystem::path  path)

Returns all bytes from the file until eof as a single buffer.

Note
use only on short files to avoid running out of memory.
Parameters
pathpath of the file to be read.