vertx / io.vertx.reactivex.core.http / HttpServerResponse / sendFile

# sendFile

`open fun sendFile(filename: String): HttpServerResponse`

Same as `io.vertx.reactivex.core.http.HttpServerResponse#sendFile` using offset @code{0} which means starting from the beginning of the file.

### Parameters

`filename` - path to the file to serve

Return
a reference to this, so the API can be used fluently

`open fun sendFile(filename: String, offset: Long): HttpServerResponse`

Same as `io.vertx.reactivex.core.http.HttpServerResponse#sendFile` using length @code{Long.MAX_VALUE} which means until the end of the file.

### Parameters

`filename` - path to the file to serve

`offset` - offset to start serving from

Return
a reference to this, so the API can be used fluently

`open fun sendFile(filename: String, offset: Long, length: Long): HttpServerResponse`

Ask the OS to stream a file as specified by `filename` directly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to serve files.

The actual serve is asynchronous and may not complete until some time after this method has returned.

### Parameters

`filename` - path to the file to serve

`offset` - offset to start serving from

`length` - length to serve to

Return
a reference to this, so the API can be used fluently

`open fun sendFile(filename: String, resultHandler: Handler<AsyncResult<Void>>): HttpServerResponse`

Like `io.vertx.reactivex.core.http.HttpServerResponse#sendFile` but providing a handler which will be notified once the file has been completely written to the wire.

### Parameters

`filename` - path to the file to serve

`resultHandler` - handler that will be called on completion

Return
a reference to this, so the API can be used fluently

`open fun sendFile(filename: String, offset: Long, resultHandler: Handler<AsyncResult<Void>>): HttpServerResponse`

Like `io.vertx.reactivex.core.http.HttpServerResponse#sendFile` but providing a handler which will be notified once the file has been completely written to the wire.

### Parameters

`filename` - path to the file to serve

`offset` - the offset to serve from

`resultHandler` - handler that will be called on completion

Return
a reference to this, so the API can be used fluently

`open fun sendFile(filename: String, offset: Long, length: Long, resultHandler: Handler<AsyncResult<Void>>): HttpServerResponse`

Like `io.vertx.reactivex.core.http.HttpServerResponse#sendFile` but providing a handler which will be notified once the file has been completely written to the wire.

### Parameters

`filename` - path to the file to serve

`offset` - the offset to serve from

`length` - the length to serve to

`resultHandler` - handler that will be called on completion

Return
a reference to this, so the API can be used fluently