MCPcopy Create free account
hub / github.com/kataras/iris / SendFileWithRate

Method SendFileWithRate

context/context.go:5519–5526  ·  view source on GitHub ↗

SendFileWithRate same as `SendFile` but it can throttle the speed of reading and though writing the file to the client.

(src, destName string, limit float64, burst int)

Source from the content-addressed store, hash-verified

5517// SendFileWithRate same as `SendFile` but it can throttle the speed of reading
5518// and though writing the file to the client.
5519func (ctx *Context) SendFileWithRate(src, destName string, limit float64, burst int) error {
5520 if destName == "" {
5521 destName = filepath.Base(src)
5522 }
5523
5524 ctx.writer.Header().Set(ContentDispositionHeaderKey, MakeDisposition(destName))
5525 return ctx.ServeFileWithRate(src, limit, burst)
5526}
5527
5528// MakeDisposition generates an HTTP Content-Disposition field-value.
5529// Similar solution followed by: Spring(Java), Symfony(PHP) and Ruby on Rails frameworks too.

Callers 2

SendFileMethod · 0.95
downloadWithRateLimitFunction · 0.80

Calls 4

ServeFileWithRateMethod · 0.95
MakeDispositionFunction · 0.85
SetMethod · 0.65
HeaderMethod · 0.45

Tested by

no test coverage detected