
  [;1m-spec sendfile(Filename, Socket) ->[0m
  [;1m                  {ok, non_neg_integer()} |[0m
  [;1m                  {error, inet:posix() | closed | badarg | not_owner}[0m
  [;1m                  when[0m
  [;1m                      Filename :: name_all(),[0m
  [;1m                      Socket ::[0m
  [;1m                          inet:socket() |[0m
  [;1m                          socket:socket() |[0m
  [;1m                          fun((iolist()) ->[0m
  [;1m                                  ok | {error, inet:posix() | closed}).[0m

[;;4mSince[0m:
  OTP R15B

  Sends the file [;;4mFilename[0m to [;;4mSocket[0m. Returns [;;4m{ok, BytesSent}[0m
  if successful, otherwise [;;4m{error, Reason}[0m.

  [;1m-spec sendfile(RawFile, Socket, Offset, Bytes, Opts) ->[0m
  [;1m                  {ok, non_neg_integer()} |[0m
  [;1m                  {error, inet:posix() | closed | badarg | not_owner}[0m
  [;1m                  when[0m
  [;1m                      RawFile :: fd(),[0m
  [;1m                      Socket ::[0m
  [;1m                          inet:socket() |[0m
  [;1m                          socket:socket() |[0m
  [;1m                          fun((iolist()) ->[0m
  [;1m                                  ok | {error, inet:posix() | closed}),[0m
  [;1m                      Offset :: non_neg_integer(),[0m
  [;1m                      Bytes :: non_neg_integer(),[0m
  [;1m                      Opts :: [sendfile_option()].[0m

[;;4mSince[0m:
  OTP R15B

  Sends [;;4mBytes[0m from the file referenced by [;;4mRawFile[0m beginning at [;;4m[0m
  [;;4mOffset[0m to [;;4mSocket[0m. Returns [;;4m{ok, BytesSent}[0m if successful,
  otherwise [;;4m{error, Reason}[0m. If [;;4mBytes[0m is set to [;;4m0[0m all data
  after the specified [;;4mOffset[0m is sent.

  The file used must be opened using the [;;4mraw[0m flag, and the process
  calling [;;4msendfile[0m must be the controlling process of the socket.
  See [;;4mgen_tcp:controlling_process/2[0m or module [;;4msocket[0m's level [;;4m[0m
  [;;4motp[0m socket option [;;4mcontrolling_process[0m.

  If the OS used does not support non-blocking [;;4msendfile[0m, an Erlang
  fallback using [;;4mread/2[0m and [;;4mgen_tcp:send/2[0m is used.

  The option list can contain the following options:

   • [;;4mchunk_size[0m - The chunk size used by the Erlang fallback to
     send data. If using the fallback, set this to a value that
     comfortably fits in the systems memory. Default is 20 MB.
