The absolute path to the directory where the content should be stored
Optional
options: { invalidCharactersRegexp?: RegExp; maxPathLength?: number }Optional
invalidCharactersRegexp?: RegExpThese characters will be removed from files that are saved to S3. There is a very strict default list that basically only leaves alphanumeric filenames intact. Should you need more relaxed settings you can specify them here.
Optional
maxPathLength?: numberProtected
contentThe absolute path to the directory where the content should be stored
Protected
Optional
optionsOptional
invalidCharactersRegexp?: RegExpThese characters will be removed from files that are saved to S3. There is a very strict default list that basically only leaves alphanumeric filenames intact. Should you need more relaxed settings you can specify them here.
Optional
maxPathLength?: numberCreates a content object in the repository. Add files to it later with addContentFile(...). Throws an error if something went wrong. In this case no traces of the content are left in storage and all changes are reverted.
The metadata of the content (= h5p.json)
the content object (= content/content.json)
The user who owns this object.
Optional
id: string(optional) The content id to use
The newly assigned content id
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 filename
A readable stream that contains the data
The user who owns this object
Checks if a piece of content exists in storage.
the content id to check
true if the piece of content exists
Protected
createGenerates a unique content id that hasn't been used in the system so far.
A unique content id
Deletes a content object and all its dependent files from the repository. Throws errors if something goes wrong.
The content id to delete.
Optional
user: IUserThe user who wants to delete the content
Deletes a file from a content object.
the content object the file is attached to
the file to delete
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
Protected
getGets the base path of the content
the base content-path
Returns information about 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 information about
the user who wants to retrieve the content file
Returns 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 content metadata (=h5p.json) for a content id
the content id for which to retrieve the metadata
Optional
user: IUser(optional) the user who wants to access the metadata. If undefined, access must be granted.
the metadata
Returns the parameters (=content.json) for a content id
the content id for which to retrieve the metadata
Optional
user: IUser(optional) the user who wants to access the metadata. If undefined, access must be granted.
the parameters
Calculates how often a library is in use.
the library for which to calculate usage.
asDependency: how often the library is used as subcontent in content; asMainLibrary: how often the library is used as a main library
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']
Removes invalid characters from filenames and enforces other filename rules required by the storage implementation (e.g. filename length restrictions).
the filename to sanitize; this can be a relative path (e.g. "images/image1.png")
the clean filename
Persists content to the disk.