Supports the behaviour described in https://www.w3.org/DesignIssues/HTTPFilenameMapping.html Determines content-type based on the file extension. In case an identifier does not end on an extension matching its content-type, the corresponding file will be appended with the correct extension, preceded by $.

Hierarchy (view full)

Constructors

Properties

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

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.

  • Helper function that removes the internal extension, one starting with $., from the given path. Nothing happens if no such extension is present.

    Parameters

    • path: string

    Returns string