SudoSOS Back-end API / internal/files/storage / FileStorage
Abstract Class: FileStorage ​
Constructors ​
Constructor ​
ts
new FileStorage(): FileStorage;Returns ​
FileStorage
Methods ​
deleteFile() ​
ts
abstract deleteFile(file): Promise<boolean>;Delete the file from the storage system
Parameters ​
| Parameter | Type |
|---|---|
file | BaseFile |
Returns ​
Promise<boolean>
true when file was deleted, false when file does not exist in storage
Throws ​
Error when file could not be deleted
getFile() ​
ts
abstract getFile(file): Promise<Buffer<ArrayBufferLike>>;Get the file from storage as a buffer object
Parameters ​
| Parameter | Type |
|---|---|
file | BaseFile |
Returns ​
Promise<Buffer<ArrayBufferLike>>
Throws ​
Error when file could not be found in storage
saveFile() ​
ts
abstract saveFile(fileName, fileData): Promise<string>;Save a file with the given name to storage
Parameters ​
| Parameter | Type |
|---|---|
fileName | string |
fileData | Buffer |
Returns ​
Promise<string>
The location of the file