import { type SendOptions } from "https://deno.land/x/oak@v13.2.5/mod.ts";
Properties
Try to serve the brotli version of a file automatically when brotli is
supported by a client and if the requested file with .br
extension
exists. (defaults to true
)
A record of extensions and content types that should be used when
determining the content of a file being served. By default, the
media_type
database is used
to map an extension to the served content-type. The keys of the map are
extensions, and values are the content types to use. The content type can
be a partial content type, which will be resolved to a full content type
header.
Any extensions matched will override the default behavior. Key should
include the leading dot (e.g. .ext
instead of just ext
).
Example
app.use((ctx) => {
return send(ctx, ctx.request.url.pathname, {
contentTypes: {
".importmap": "application/importmap+json"
},
root: ".",
})
});
Try to match extensions from passed array to search for file when no
extension is sufficed in URL. First found is served. (defaults to
undefined
)
If true
, format the path to serve static file servers and not require a
trailing slash for directories, so that you can do both /directory
and
/directory/
. (defaults to true
)
Try to serve the gzipped version of a file automatically when gzip is
supported by a client and if the requested file with .gz
extension
exists. (defaults to true
).
Tell the browser the resource is immutable and can be cached
indefinitely. (defaults to false
)
Name of the index file to serve automatically when visiting the root location. (defaults to none)
A size in bytes where if the file is less than this size, the file will
be read into memory by send instead of returning a file handle. Files less
than the byte size will send an "strong" ETag
header while those larger
than the bytes size will only be able to send a "weak" ETag
header (as
they cannot hash the contents of the file). (defaults to 1MiB)