SudoSOS Back-end API / internal/files/storage / DiskStorage
Class: DiskStorage ​
Implements ​
Constructors ​
Constructor ​
ts
new DiskStorage(workdir): DiskStorage;Parameters ​
| Parameter | Type |
|---|---|
workdir | string |
Returns ​
DiskStorage
Methods ​
deleteFile() ​
ts
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
Implementation of ​
getFile() ​
ts
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
Implementation of ​
saveFile() ​
ts
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
Implementation of ​
validateFileLocation() ​
ts
validateFileLocation(location): void;Parameters ​
| Parameter | Type |
|---|---|
location | string |
Returns ​
void