Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for a snapshot of the master branch, built from commit b5c99c1c90.
PrevUpHomeNext

http::file_body

A message body represented by a file on the filesystem.

Synopsis

Defined in header <boost/beast/http/file_body.hpp>

using file_body = basic_file_body< file >;
Types

Name

Description

file_type

The type of File this body uses.

reader

Algorithm for storing buffers when parsing.

value_type

The type of the message::body member.

writer

Algorithm for retrieving buffers when serializing.

Member Functions

Name

Description

size

Returns the size of the body.

Messages with this type have bodies represented by a file on the file system. When parsing a message using this body type, the data is stored in the file pointed to by the path, which must be writable. When serializing, the implementation will read the file and present those octets as the body content. This may be used to serve content from a directory as part of a web service.

Template Parameters

Type

Description

File

The implementation to use for accessing files. This type must meet the requirements of File.

Types

Name

Description

native_handle_type

The type of the underlying file handle.

Member Functions

Name

Description

close

Close the file if open.

is_open

Returns true if the file is open.

native_handle

Returns the native handle associated with the file.

Set the native handle associated with the file.

open

Open a file at the given path with the specified mode.

pos

Return the current position in the open file.

read

Read from the open file.

seek

Adjust the current position in the open file.

size

Return the size of the open file.

write

Write to the open file.

This alias is set to the best available implementation of File given the platform and build settings.

Description

PrevUpHomeNext