Function ros2_medkit_gateway::stream_file_to_response

Function Documentation

inline bool ros2_medkit_gateway::stream_file_to_response(httplib::Response &res, const std::string &file_path, const std::string &content_type)

Stream file contents to HTTP response using chunked transfer.

Generic utility for streaming any file to an HTTP response. The file path must point to an existing regular file (resolve rosbag directories etc. before calling this function).

Parameters:
  • res – HTTP response to write to

  • file_path – Path to an existing regular file

  • content_type – MIME type for Content-Type header

Returns:

true if successful, false if file could not be read