Skip to main content

Class: FsStorage

mugshot.FsStorage

Write and read baselines to and from the local file system.

Screenshots will be saved with a .png extension.

Implements#

Constructors#

constructor#

+ new FsStorage(resultsPath: string): FsStorage

Parameters:#

NameTypeDescription
resultsPathstringAn absolute path or a path relative to cwd. The entire parent folder structure will be created if missing.

Returns: FsStorage

Defined in: packages/mugshot/src/lib/fs-storage.ts:10

Methods#

delete#

delete(name: string): Promise<void>

Delete the screenshot for name.

If the screenshot doesn't exist, this should be a no-op.

Parameters:#

NameType
namestring

Returns: Promise<void>

Implementation of: ScreenshotStorage.delete

Defined in: packages/mugshot/src/lib/fs-storage.ts:24


exists#

exists(name: string): Promise<boolean>

Check whether a screenshot exists for name.

Parameters:#

NameType
namestring

Returns: Promise<boolean>

Implementation of: ScreenshotStorage.exists

Defined in: packages/mugshot/src/lib/fs-storage.ts:20


read#

read(name: string): Promise<Buffer>

Return the screenshot for name as a PNG encoded buffer.

Parameters:#

NameType
namestring

Returns: Promise<Buffer>

Implementation of: ScreenshotStorage.read

Defined in: packages/mugshot/src/lib/fs-storage.ts:22


write#

write(name: string, data: Buffer): Promise<void>

Write a screenshot for name.

Parameters:#

NameType
namestring
dataBuffer

Returns: Promise<void>

Implementation of: ScreenshotStorage.write

Defined in: packages/mugshot/src/lib/fs-storage.ts:17