Contains logic to store content in permanent storage. Copies files from temporary storage and deletes unused files.

Constructors

Methods

  • Saves content in the persistence system. Also copies over files from temporary storage or from other content if the content was pasted from there.

    Note: This method has side-effects on the parameters argument, meaning it mutates the object!

    Parameters

    • contentId: string

      the contentId (can be undefined if previously unsaved)

    • parameters: any

      the parameters of the content (= content.json)

    • metadata: IContentMetadata

      = content of h5p.json

    • mainLibraryName: ILibraryName

      the library name

    • user: IUser

      the user who wants to save the file

    Returns Promise<string>

  • Adds content from a H5P package (in a temporary directory) to the system.

    Parameters

    • metadata: IContentMetadata
    • packageDirectory: string

      The absolute path containing the package (the directory containing h5p.json)

    • user: IUser

      The user who is adding the package.

    • OptionalcontentId: string

      (optional) The content id to use for the package

    Returns Promise<{ id: string; metadata: IContentMetadata; parameters: any }>

    The id of the content that was created (the one passed to the method or a new id if there was none).

    The method should not be used as it anymore, as there might be issues with invalid filenames!