MutableMediaStorage

class MutableMediaStorage(options: MediaStorageOptions, nameProvider: MediaNameProviderStrategy = SanitizedMediaNameProvider()) : ReadOnlyMediaStorage

A media storage that can be modified with new entries.

Parameters

options

storage rules

nameProvider

strategy used to generate media names. The name of a media is defines the file name in the output directory, hence this is the resource the document should refer to (e.g. images).

Constructors

Link copied to clipboard
constructor(options: MediaStorageOptions, nameProvider: MediaNameProviderStrategy = SanitizedMediaNameProvider())

Properties

Link copied to clipboard
open override val all: Set<StoredMedia>

All the stored entries.

Functions

Link copied to clipboard
fun register(path: String, workingDirectory: File?)

Registers a media by its path. The corresponding media is resolved lazily from the path.

Link copied to clipboard
open override fun resolve(path: String): StoredMedia?

Resolves a media by its path.

Link copied to clipboard
open override fun resolveMediaLocationOrFallback(path: String): String

Retrieves the media location of a media file, starting from the output directory. If the media file is not found in the local storage, a fallback location is returned, which is usually the original path.

Link copied to clipboard
open override fun toResource(): OutputResource

Converts this storage to an OutputResource. This is used to export all media to the output directory. Ideally, this method returns an com.quarkdown.core.pipeline.output.OutputResourceGroup which contains all media inside of it.