Interface FileIdentifierMapper

Supports mapping a file to an URL and back.

interface FileIdentifierMapper {
    mapFilePathToUrl: ((filePath: string, isContainer: boolean) => Promise<ResourceLink>);
    mapUrlToFilePath: ((identifier: ResourceIdentifier, isMetadata: boolean, contentType?: string) => Promise<ResourceLink>);
}

Implemented by

Properties

mapFilePathToUrl: ((filePath: string, isContainer: boolean) => Promise<ResourceLink>)

Maps the given file path to an URL and determines the content-type

Type declaration

    • (filePath, isContainer): Promise<ResourceLink>
    • Parameters

      • filePath: string

        The input file path.

      • isContainer: boolean

        If the path corresponds to a file.

      Returns Promise<ResourceLink>

      A ResourceLink with all the necessary metadata.

mapUrlToFilePath: ((identifier: ResourceIdentifier, isMetadata: boolean, contentType?: string) => Promise<ResourceLink>)

Maps the given resource identifier / URL to a file path. Determines the content-type, if no content-type was provided, by finding the corresponding file. If there is no corresponding file, a file path will be generated. For containers, the content-type input gets ignored.

Type declaration

    • (identifier, isMetadata, contentType?): Promise<ResourceLink>
    • Parameters

      • identifier: ResourceIdentifier

        The input identifier.

      • isMetadata: boolean

        If we are mapping the metadata of the resource instead of its data.

      • OptionalcontentType: string

        The (optional) content-type of the resource.

      Returns Promise<ResourceLink>

      A ResourceLink with all the necessary metadata.