Method Stdio.sendfile()->create()
- Method
create
Stdio.sendfile Stdio.sendfile(
array
(string
)headers
,object
from
,int
offset
,int
len
,array
(string
)trailers
,object
to
,function
(:void
)callback
,mixed
...args
)- Description
Low-level implementation of Stdio.sendfile().
Sends
headers
followed bylen
bytes starting atoffset
from the filefrom
followed bytrailers
to the fileto
. When completedcallback
will be called with the total number of bytes sent as the first argument, followed byargs
.Any of
headers
,from
andtrailers
may be left out by setting them to0
.Setting
offset
to-1
means send from the current position infrom
.Setting
len
to-1
means send untilfrom
's end of file is reached.- Note
Don't use this class directly! Use Stdio.sendfile() instead.
In Pike 7.7 and later the
callback
function will be called from the backend associated withto
.- Note
May use blocking I/O and thus trigger process being killed with SIGPIPE when the other end closes the connection. Add a call to signal() to avoid this.
- See also