LocalAssetStorageStrategy

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)
  async writeFileFromStream(fileName: string, data: ReadStream) => Promise<string>;
  async writeFileFromBuffer(fileName: string, data: Buffer) => Promise<string>;
  fileExists(fileName: string) => Promise<boolean>;
  readFileToBuffer(identifier: string) => Promise<Buffer>;
  readFileToStream(identifier: string) => Promise<Stream>;
}

Members

toAbsoluteUrl

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

constructor

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

writeFileFromStream

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

writeFileFromBuffer

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

fileExists

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

readFileToBuffer

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

readFileToStream

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