Update FilesAdapter comments (#4065)
This commit is contained in:
committed by
Florent Vilmart
parent
1914083942
commit
952e64d94a
@@ -4,32 +4,54 @@
|
||||
// Allows you to change the file storage mechanism.
|
||||
//
|
||||
// Adapter classes must implement the following functions:
|
||||
// * createFile(config, filename, data)
|
||||
// * getFileData(config, filename)
|
||||
// * getFileLocation(config, request, filename)
|
||||
// * createFile(filename, data, contentType)
|
||||
// * deleteFile(filename)
|
||||
// * getFileData(filename)
|
||||
// * getFileLocation(config, filename)
|
||||
//
|
||||
// Default is GridStoreAdapter, which requires mongo
|
||||
// and for the API server to be using the DatabaseController with Mongo
|
||||
// database adapter.
|
||||
|
||||
import type { Config } from '../../Config'
|
||||
|
||||
export class FilesAdapter {
|
||||
/* This method is responsible to store the file in order to be retrieved later by its file name
|
||||
|
||||
/* Responsible for storing the file in order to be retrieved later by its filename
|
||||
*
|
||||
* @param filename the filename to save
|
||||
* @param data the buffer of data from the file
|
||||
* @param contentType the supposed contentType
|
||||
* @param {string} filename - the filename to save
|
||||
* @param {*} data - the buffer of data from the file
|
||||
* @param {string} contentType - the supposed contentType
|
||||
* @discussion the contentType can be undefined if the controller was not able to determine it
|
||||
*
|
||||
* @return a promise that should fail if the storage didn't succeed
|
||||
*
|
||||
* @return {Promise} a promise that should fail if the storage didn't succeed
|
||||
*/
|
||||
createFile(filename: string, data, contentType: string) { }
|
||||
createFile(filename: string, data, contentType: string): Promise { }
|
||||
|
||||
deleteFile(filename) { }
|
||||
/* Responsible for deleting the specified file
|
||||
*
|
||||
* @param {string} filename - the filename to delete
|
||||
*
|
||||
* @return {Promise} a promise that should fail if the deletion didn't succeed
|
||||
*/
|
||||
deleteFile(filename: string): Promise { }
|
||||
|
||||
getFileData(filename) { }
|
||||
/* Responsible for retrieving the data of the specified file
|
||||
*
|
||||
* @param {string} filename - the name of file to retrieve
|
||||
*
|
||||
* @return {Promise} a promise that should pass with the file data or fail on error
|
||||
*/
|
||||
getFileData(filename: string): Promise<any> { }
|
||||
|
||||
getFileLocation(config, filename) { }
|
||||
/* Returns an absolute URL where the file can be accessed
|
||||
*
|
||||
* @param {Config} config - server configuration
|
||||
* @param {string} filename
|
||||
*
|
||||
* @return {string} Absolute URL
|
||||
*/
|
||||
getFileLocation(config: Config, filename: string): string { }
|
||||
}
|
||||
|
||||
export default FilesAdapter;
|
||||
|
||||
Reference in New Issue
Block a user