mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-23 10:16:32 -05:00
Define a MediaBackend interface
This interface defines the functionality that all media backends (like S3 or Azure) must implement. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
f01c7dbbe2
commit
9d8086bf3e
1 changed files with 25 additions and 0 deletions
25
src/media/media-backend.interface.ts
Normal file
25
src/media/media-backend.interface.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { BackendData } from './media-upload.entity';
|
||||
|
||||
export interface MediaBackend {
|
||||
/**
|
||||
* Saves a file according to backend internals.
|
||||
* @param buffer File data
|
||||
* @param fileName Name of the file to save. Can include a file extension.
|
||||
* @return Tuple of file URL and internal backend data, which should be saved.
|
||||
*/
|
||||
saveFile(buffer: Buffer, fileName: string): Promise<[string, BackendData]>;
|
||||
|
||||
/**
|
||||
* Retrieve the URL of a previously saved file.
|
||||
* @param fileName String to identify the file
|
||||
* @param backendData Internal backend data
|
||||
*/
|
||||
getFileURL(fileName: string, backendData: BackendData): Promise<string>;
|
||||
|
||||
/**
|
||||
* Delete a file from the backend
|
||||
* @param fileName String to identify the file
|
||||
* @param backendData Internal backend data
|
||||
*/
|
||||
deleteFile(fileName: string, backendData: BackendData): Promise<void>;
|
||||
}
|
Loading…
Reference in a new issue