H5P.fs(...)that uses basic file system implementations for all data storage services. You can use the function if you're just getting started. Later on, you'll want to construct the editor with custom implementations of the data storage services. Check out the JSDoc of the function for details how to use it.
new H5P.H5PEditor(...). The constructor arguments are used to provide data storage services and settings. You can find the interfaces referenced in
cacheobject is used by the
ContentTypeCacheto persist information about content types. It might be also used for other functionality in the future. It must be able to store arbitrary nested objects and must implement the interface
IKeyValueStorage. If used in a multi-machine or multi-process setup, the cache must be a single point of truth and work across all processes.
IH5PConfiginterface. You can use the sample implementation in
libraryStorageprovides information about installed libraries and installs them. It must implement the
contentStorageprovides information about installed content and creates it. It must implement the
IContentStorageinterface. If you store all library information as files in folders under
./h5p/contentyou can use the sample implementation in
ITemporaryFileStorage. Furthermore, you should regularly call
H5PEditor.temporaryFileManager.cleanUp()to remove unneeded temporary files (every 5 min).
baseUrlfunction if needed.The url generator can also be used to add CSRF tokens to POST URLs.