@mashroom-content/mashroom-content-asset-processing
v1.0.3
Published
Mashroom Content Asset services
Downloads
17
Readme
Mashroom Content Assets
Plugin for Mashroom Server, a Microfrontend Integration Platform. Part of the Mashroom Content extension.
This plugin adds a service to fetch and process assets (e.g. image conversion).
Usage
If node_modules/@mashroom is configured as plugin path just add @mashroom-content/mashroom-content-asset-processing as dependency.
You can override the default config in your Mashroom config file like this:
{
"plugins": {
"Mashroom Content Asset Processing Services": {
"scaleUp": false,
"defaultQuality": 75,
"cacheEnable": true,
"cacheDefaultTTLSec": 31536000,
"cacheFolder": "./data/asset-proc-cache"
}
}
}
- scaleUp: Scale images up (Default: false)
- defaultQuality: Default image conversion quality (Default: 75)
- cacheEnable: Enable asset cache (Default: true)
- cacheDefaultTTLSec: Asset cache TTL in seconds (Default: 31536000)
- cacheFolder: Cache folder (Default: ./data/asset-proc-cache)
Service
On the Server side you can use the following new service accessible through pluginContext.services.assetProc.service:
export interface MashroomContentAssetProcService {
/**
* Process and return given asset from URI - result will be cached
*/
processAssetFromUri(assetUri: string, resize?: MashroomContentAssetProcImageResize, convert?: MashroomContentAssetProcImageConvert): Promise<MashroomContentAssetProc>;
/**
* Process given asset
*/
processAsset(asset: Readable, resize?: MashroomContentAssetProcImageResize, convert?: MashroomContentAssetProcImageConvert): Promise<Readable>;
}