Class: ServeFile
Defined in: serve-file.ts:9
Service that serves a single file.
Implements
Constructors
Constructor
new ServeFile(
path
,mimeType?
):ServeFile
Defined in: serve-file.ts:15
Creates a new ServeFile.
Parameters
path
string
mimeType?
string
Returns
ServeFile
Methods
invoke()
invoke(
req
):Promise
<HttpResponse
>
Defined in: serve-file.ts:94
Process the request and return the response asynchronously.
Parameters
req
Returns
Implementation of
precompressedBr()
precompressedBr():
this
Defined in: serve-file.ts:53
Informs the service that it should also look for a precompressed brotli version of the file.
If the client has an Accept-Encoding
header that allows the brotli encoding, the file foo.txt.br
instead of foo.txt
.
If the precompressed file is not available, or the client doesn't support it, the uncompressed version will be served instead. Both the precompressed version and the uncompressed version are expected to be present in the same directory. Different precompressed variants can be combined.
Returns
this
precompressedDeflate()
precompressedDeflate():
this
Defined in: serve-file.ts:71
Informs the service that it should also look for a precompressed deflate version of the file.
If the client has an Accept-Encoding
header that allows the deflate encoding, the file foo.txt.zz
instead of foo.txt
.
If the precompressed file is not available, or the client doesn't support it, the uncompressed version will be served instead. Both the precompressed version and the uncompressed version are expected to be present in the same directory. Different precompressed variants can be combined.
Returns
this
precompressedGzip()
precompressedGzip():
this
Defined in: serve-file.ts:35
Informs the service that it should also look for a precompressed gzip version of the file.
If the client has an Accept-Encoding
header that allows the gzip encoding, the file foo.txt.gz
instead of foo.txt
.
If the precompressed file is not available, or the client doesn't support it, the uncompressed version will be served instead. Both the precompressed version and the uncompressed version are expected to be present in the same directory. Different precompressed variants can be combined.
Returns
this
precompressedZstd()
precompressedZstd():
this
Defined in: serve-file.ts:89
Informs the service that it should also look for a precompressed zstd version of the file.
If the client has an Accept-Encoding
header that allows the zstd encoding, the file foo.txt.zst
instead of foo.txt
.
If the precompressed file is not available, or the client doesn't support it, the uncompressed version will be served instead. Both the precompressed version and the uncompressed version are expected to be present in the same directory. Different precompressed variants can be combined.
Returns
this