A mapper that always returns a fixed content type for files.

Hierarchy (view full)

Constructors

  • Parameters

    • base: string

      Base URL.

    • rootFilepath: string

      Base file path.

    • contentType: string

      Fixed content type that will be used for all resources.

    • pathSuffix: string = ''

      An optional suffix that will be appended to all file paths. Requested file paths without this suffix will be rejected.

    • urlSuffix: string = ''

      An optional suffix that will be appended to all URL. Requested URLs without this suffix will be rejected.

    Returns FixedContentTypeMapper

Properties

baseRequestURI: string
contentType: string
logger: Logger = ...
pathSuffix: string
rootFilepath: string
unknownMediaTypeExtension: "unknown" = 'unknown'
urlSuffix: string

Methods

  • Maps the given document identifier to a file path, possibly making alterations to the direct translation (for instance, based on its content type)). Determines the content type if none was provided.

    Parameters

    • identifier: ResourceIdentifier

      The input identifier.

    • filePath: string

      The direct translation of the identifier onto the file path.

    • OptionalcontentType: string

      The content-type provided with the request.

    Returns Promise<ResourceLink>

    A ResourceLink with all the necessary metadata.