RejectedSoftware Forums

Sign up

fastest way to serve static file with custom headers

what is the fastest way to server a file from disk
and set custom headers such as cache control?

is it possible so that internally sendfile gets used?

Re: fastest way to serve static file with custom headers

Am 25.09.2015 um 00:24 schrieb yawniek:

what is the fastest way to server a file from disk
and set custom headers such as cache control?

is it possible so that internally sendfile gets used?

On GIT master, incidentally I've made sendFile public just yesterday.
But for the time being, serveStaticFile(path)(req, res); can be used.
The only drawback is that it will to a GC allocation, even if just a
small one.

Re: fastest way to serve static file with custom headers

On Fri, 25 Sep 2015 10:40:36 +0200, Sönke Ludwig wrote:

Am 25.09.2015 um 00:24 schrieb yawniek:

what is the fastest way to server a file from disk
and set custom headers such as cache control?

is it possible so that internally sendfile gets used?

On GIT master, incidentally I've made sendFile public just yesterday.
But for the time being, serveStaticFile(path)(req, res); can be used.
The only drawback is that it will to a GC allocation, even if just a
small one.

thanks. cool!

i made it work with serveStaticFile, my problem was actually a bug with libasync and i forgot that i was using that.