Skip to main content

LocalAssetStorageStrategy

LocalAssetStorageStrategy

A persistence strategy which saves files to the local file system.

Signature
class LocalAssetStorageStrategy implements AssetStorageStrategy {
toAbsoluteUrl: ((reqest: Request, identifier: string) => string) | undefined;
constructor(uploadPath: string, toAbsoluteUrlFn?: (reqest: Request, identifier: string) => string)
writeFileFromStream(fileName: string, data: ReadStream) => Promise<string>;
writeFileFromBuffer(fileName: string, data: Buffer) => Promise<string>;
fileExists(fileName: string) => Promise<boolean>;
readFileToBuffer(identifier: string) => Promise<Buffer>;
readFileToStream(identifier: string) => Promise<Stream>;
deleteFile(identifier: string) => Promise<void>;
}

toAbsoluteUrl

property
((reqest: Request, identifier: string) => string) | undefined

constructor

method
(uploadPath: string, toAbsoluteUrlFn?: (reqest: Request, identifier: string) => string) => LocalAssetStorageStrategy

writeFileFromStream

method
(fileName: string, data: ReadStream) => Promise<string>

writeFileFromBuffer

method
(fileName: string, data: Buffer) => Promise<string>

fileExists

method
(fileName: string) => Promise<boolean>

readFileToBuffer

method
(identifier: string) => Promise<Buffer>

readFileToStream

method
(identifier: string) => Promise<Stream>

deleteFile

method
(identifier: string) => Promise<void>