Skip to content

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 ​

ParameterType
fileBaseFile

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 ​

ParameterType
fileBaseFile

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 ​

ParameterType
fileNamestring
fileDataBuffer

Returns ​

Promise<string>

The location of the file