Assetsmodule

assets. Assetsmodule

Handling of assets

Constructor

new Assetsmodule()

Source:

Extends

  • AbstractApiModule

Members

assetTypes

Description:
  • Store of all registered asset types
Source:
Store of all registered asset types

Methods

(async) checkDuplicate(filepath, fileSize, excludeQueryopt) → {Promise.<(string|null)>}

Description:
  • Checks for an existing asset with the same file content. Uses a cheap size pre-check to avoid hashing when no candidate exists. When no size match is found, returns null so the caller can defer hash computation to AbstractAsset#updateFile, which handles null via its precomputedHash parameter fallback.
Source:
Parameters:
Name Type Attributes Description
filepath string Path to the uploaded file
fileSize number Size of the uploaded file in bytes
excludeQuery object <optional>
Optional query to exclude (e.g. self on update)
Throws:
If a duplicate is found
Type
DUPLICATE_ASSET
Returns:
The computed hash if a size candidate was found, or null if not
Type
Promise.<(string|null)>

createFsWrapper(assetData) → {AbstractAsset}

Description:
  • Creates an asset wrapper for file system operations
Source:
Parameters:
Name Type Description
assetData object The database data
Returns:
Type
AbstractAsset

(async) delete()

Source:

(async) deleteMany()

Source:

(async) ensureLibPermissions() → {Promise}

Description:
  • Verifies and attempts to correct execution issues with ffmpeg/ffprobe binaries
Source:
Returns:
Type
Promise

(async) find()

Source:

(async) init()

Source:

(async) insert()

Source:

(async) onRequest(req)

Description:
  • Handles incoming file uploads
Source:
Parameters:
Name Type Description
req external:ExpressRequest

(async) performHousekeeping() → {Promise}

Source:
Returns:
Type
Promise

registerAssetType(assetClass)

Description:
  • Registers a new asset repository as an assets store
Source:
Parameters:
Name Type Description
assetClass AbstractAsset The AbstractAsset class

(async) serveAssetHandler(req, res, next)

Description:
  • Serves a single asset or thumbnail
Source:
Parameters:
Name Type Description
req external:ExpressRequest
res external:ExpressResponse
next function

(async) setValues()

Source:

(async) update()

Source: