2016-01-28 10:58:12 -08:00
|
|
|
// Files Adapter
|
|
|
|
|
//
|
|
|
|
|
// Allows you to change the file storage mechanism.
|
|
|
|
|
//
|
|
|
|
|
// Adapter classes must implement the following functions:
|
2016-02-09 19:52:25 -08:00
|
|
|
// * createFile(config, filename, data)
|
|
|
|
|
// * getFileData(config, filename)
|
2016-02-08 22:51:58 -08:00
|
|
|
// * getFileLocation(config, request, filename)
|
2016-01-28 10:58:12 -08:00
|
|
|
//
|
|
|
|
|
// Default is GridStoreAdapter, which requires mongo
|
2016-02-27 02:02:33 -08:00
|
|
|
// and for the API server to be using the DatabaseController with Mongo
|
2016-01-28 10:58:12 -08:00
|
|
|
// database adapter.
|
|
|
|
|
|
2016-02-08 22:51:58 -08:00
|
|
|
export class FilesAdapter {
|
2016-08-16 13:29:34 -07:00
|
|
|
/* This method is responsible to store the file in order to be retrieved later by its file name
|
2016-03-23 23:29:16 -04:00
|
|
|
*
|
2016-03-01 15:45:11 -05:00
|
|
|
* @param filename the filename to save
|
|
|
|
|
* @param data the buffer of data from the file
|
|
|
|
|
* @param contentType the supposed contentType
|
2016-03-23 23:29:16 -04:00
|
|
|
* @discussion the contentType can be undefined if the controller was not able to determine it
|
|
|
|
|
*
|
2016-03-01 15:45:11 -05:00
|
|
|
* @return a promise that should fail if the storage didn't succeed
|
2016-03-23 23:29:16 -04:00
|
|
|
*
|
2016-03-01 15:45:11 -05:00
|
|
|
*/
|
2016-03-23 23:29:16 -04:00
|
|
|
createFile(filename: string, data, contentType: string) { }
|
2016-02-08 22:51:58 -08:00
|
|
|
|
2016-03-23 23:29:16 -04:00
|
|
|
deleteFile(filename) { }
|
2016-02-10 18:42:21 -05:00
|
|
|
|
2016-03-23 23:29:16 -04:00
|
|
|
getFileData(filename) { }
|
2016-02-08 22:51:58 -08:00
|
|
|
|
2016-02-09 19:31:23 -08:00
|
|
|
getFileLocation(config, filename) { }
|
2016-02-08 22:51:58 -08:00
|
|
|
}
|
2016-02-09 12:53:02 -08:00
|
|
|
|
|
|
|
|
export default FilesAdapter;
|