Simple file manager with cross-browser support. That uses the FileReader to create previews. Can be replaced with a more advanced version that obtains files from storage.
The replacement should support the same public methods and return the same types.
- Source:
Methods
(static) getCurrentFiles() → {Array.File}
- Source:
Obtain files currently stored in file input elements of open record
Returns:
array of files
- Type
- Array.File
(static) getFileUrl(subject) → {Promise|string|Error}
- Source:
Obtains a URL that can be used to show a preview of the file when used as a src attribute.
It is meant for media previews and media downloads.
Parameters:
Name | Type | Description |
---|---|---|
subject |
string | object | File or filename in local storage |
Returns:
promise url string or rejection with Error
- Type
- Promise | string | Error
(static) getMaxSizeReadable() → {string}
- Source:
Replace with function that determines max size published in OpenRosa server response header.
Returns:
human radable maximiym size
- Type
- string
(static) getObjectUrl(subject) → {Promise|string|Error}
- Source:
Similar to getFileURL, except that this one is guaranteed to return an objectURL
It is meant for loading images into a canvas.
Parameters:
Name | Type | Description |
---|---|---|
subject |
string | object | File or filename in local storage |
Returns:
promise url string or rejection with Error
- Type
- Promise | string | Error
(static) init() → {Promise|boolean|Error}
- Source:
Initialize the file manager.
Returns:
promise boolean or rejection with Error
- Type
- Promise | boolean | Error
(static) isTooLarge() → {boolean}
- Source:
Placeholder function to check if file size is acceptable.
Returns:
whether file is too large
- Type
- boolean
(static) isWaitingForPermissions() → {boolean}
- Source:
Whether the filemanager is waiting for user permissions
Returns:
[description]
- Type
- boolean
(static) urlToBlob(url) → {Promise}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
url |
string | url to get |
Returns:
promise of XMLHttpRequesting given url
- Type
- Promise