Members
assetRoot :string
- Description:
- The root location for this asset type
- Source:
The root location for this asset type
Type:
- string
ffmpeg :*
- Description:
- Reference to the ffmpeg module
- Source:
Reference to the ffmpeg module
Type:
- *
ffprobe :*
- Description:
- Reference to the ffprobe module
- Source:
Reference to the ffprobe module
Type:
- *
hasThumb
- Description:
- Whether the asset has a thumbnail
- Source:
Whether the asset has a thumbnail
isAudio
- Description:
- Whether the asset is an audio file
- Source:
Whether the asset is an audio file
isImage
- Description:
- Whether the asset is an image file
- Source:
Whether the asset is an image file
isVideo
- Description:
- Whether the asset is an video file
- Source:
Whether the asset is an video file
path :string
- Description:
- The asset path
- Source:
The asset path
Type:
- string
thumb
- Description:
- Access to the thumbnail asset
- Source:
Access to the thumbnail asset
(static) name :string
- Description:
- Name of the asset type
- Source:
Name of the asset type
Type:
- string
Methods
(async) delete() → {Promise}
- Description:
- Removes a file from the repository
- Source:
Returns:
- Type
- Promise
(async) ensureDir(dir) → {Promise}
- Description:
- Ensures a directory exists, creating it if not. Must be overridden by subclasses.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
dir |
string | Directory to check |
Returns:
- Type
- Promise
(async) ensureExists() → {Promise}
- Description:
- Checks if a file exists. Must be overridden by subclasses.
- Source:
Returns:
Rejects if not found
- Type
- Promise
(async) generateThumb(options)
- Description:
- Generate a thumbnail for an existing asset
- Source:
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
object | Optional settings
Properties
|
getFileExtension(file) → {String}
- Description:
- Returns the expected file type from a MIME subtype
- Source:
Parameters:
Name | Type | Description |
---|---|---|
file |
FormidableFile | File data |
Returns:
- Type
- String
(async) move(newPath) → {Promise}
Parameters:
Name | Type | Description |
---|---|---|
newPath |
string | New path for file |
Returns:
- Type
- Promise
(async) read() → {external:stream~Readable}
- Description:
- Read a file. Must be overridden by subclasses.
- Source:
Returns:
- Type
- external:stream~Readable
resolvePath(filePath) → {string}
- Description:
- Resolves a relative path to the root directory. Must be overridden by subclasses.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filePath |
string |
Returns:
The resolved path
- Type
- string
(async) updateFile(file) → {object}
- Description:
- Performs the required file operations when uploading/replacing an asset
- Source:
Parameters:
Name | Type | Description |
---|---|---|
file |
FormidableFile | Uploaded file data |
Returns:
The update data
- Type
- object
(async) write(inputStream, outputPath) → {Promise}
- Description:
- Write a file to the repository. Must be overridden by subclasses.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
inputStream |
external:stream~Readable | The file read stream |
outputPath |
string | Path at which to store the file |
Returns:
- Type
- Promise
Type Definitions
generateMetadata
- Description:
- Sets metadata on an existing asset
- Source:
Sets metadata on an existing asset