The storage object
Optional
contentUserDataStorage: IContentUserDataStorageThe contentUserDataStorage to delete contentUserData for content when it is deleted
The storage object
Optional
contentThe contentUserDataStorage to delete contentUserData for content when it is deleted
Adds a content file to an existing content object. The content object has to be created with createContent(...) first.
The id of the content to add the file to
The name of the content file
A readable stream that contains the data
The user who owns this object
Checks if a piece of content exists.
the content to check
true if the piece of content exists
Checks if a file exists.
The id of the content to add the file to
the filename of the file to get
true if the file exists
Creates a content object in the repository. Add files to it later with addContentFile(...).
The metadata of the content (= h5p.json)
the content object (= content/content.json)
The user who owns this object.
Optional
contentId: string(optional) The content id to use
The newly assigned content id
Deletes a piece of content, the corresponding contentUserData and all files dependent on it.
the piece of content to delete
the user who wants to delete it
Deletes a file from a content object.
the content object the file is attached to
the file to delete
Optional
user: IUserReturns a readable stream of a content file (e.g. image or video) inside a piece of content
the id of the content object that the file is attached to
the filename of the file to get
the user who wants to retrieve the content file
Optional
rangeStart: number(optional) the position in bytes at which the stream should start
Optional
rangeEnd: number(optional) the position in bytes at which the stream should end
Returns the metadata (=contents of h5p.json) of a piece of content.
the content id
The user who wants to access the content
Returns the content object (=contents of content/content.json) of a piece of content.
the content id
The user who wants to access the content
Lists the content objects in the system (if no user is specified) or owned by the user.
Optional
user: IUser(optional) the user who owns the content
a list of contentIds
Gets the filenames of files added to the content with addContentFile(...) (e.g. images, videos or other files)
the piece of content
the user who wants to access the piece of content
a list of files that are used in the piece of content, e.g. ['image1.png', 'video2.mp4']
The ContentManager takes care of saving content and dependent files. It only contains storage-agnostic functionality and depends on a ContentStorage object to do the actual persistence.