[]previous and next page

FileOptions

Options of file.

Options of file.

Import#

ts
import type { FileOptions } from "@shadow-js/dusk/server";

Signature#

ts
interface FileOptions {
  /**
   * The request the file answers. Its `Range` (single range, with `If-Range`), `If-None-Match` and `If-Modified-Since`
   * decide the answer: 206, 416 or 304. Without it the file is always a 200.
   */
  readonly request?: Request;
  /**
   * The download name: `Content-Disposition: attachment`. A non-ASCII name gets an ASCII fallback and an RFC 5987
   * `filename*`. A name with CR or LF is refused (a header injection).
   */
  readonly filename?: string;
  /** The media type. Default `application/octet-stream`. */
  readonly type?: string;
  /** The `Cache-Control` value, sent as given. */
  readonly cacheControl?: string;
  /** The entity tag, quotes included (`"v1"` or `W/"v1"`). Sent as `ETag` and matched by `If-None-Match`. */
  readonly etag?: string;
  /** The modification time. Sent as `Last-Modified` and matched by `If-Modified-Since`. */
  readonly lastModified?: Date;
}

Members#

Name Type Description
request? readonly request?: Request The request the file answers. Its Range (single range, with If-Range), If-None-Match and If-Modified-Since decide the answer: 206, 416 or 304. Without it the file is always a 200.
filename? readonly filename?: string The download name: Content-Disposition: attachment. A non-ASCII name gets an ASCII fallback and an RFC 5987 filename*. A name with CR or LF is refused (a header injection).
type? readonly type?: string The media type. Default application/octet-stream.
cacheControl? readonly cacheControl?: string The Cache-Control value, sent as given.
etag? readonly etag?: string The entity tag, quotes included ("v1" or W/"v1"). Sent as ETag and matched by If-None-Match.
lastModified? readonly lastModified?: Date The modification time. Sent as Last-Modified and matched by If-Modified-Since.