Shutter.sh API client package.
import { createSnapshot, retrieveFile, loadFileFromDisk } from '@shutter/api'
createSnapshot(authToken: string, page: File, pageAssets: File[], options: SnapshotCreationOptions = {}): Promise<Snapshot>
Sends an HTML document and additional assets to the shutter.sh service for rendering. Returns a promise that resolves upon finished upload. The snapshot will not have been rendered yet (see retrieveProcessedSnapshot
).
interface SnapshotCreationOptions {
expectation?: File | null,
diffOptions?: DiffOptions,
labels?: Labels,
renderOptions?: RenderOptions
}
interface DiffOptions {
autoCrop?: boolean,
relativeThreshold?: number
}
interface RenderOptions {
autoCrop?: boolean,
omitBackground?: boolean
}
type Snapshot = any // Not yet typed
Takes a file hash as included in the Snapshot
body and returns a promise that resolves to a Buffer
containing the file contents.
Takes a snapshot ID and returns a promise resolving to the rendered snapshot once the rendering has completed.
Takes a Buffer
and wraps it to become a File
.
interface FromBufferOptions {
contentType?: string
}
Loads a file from the file system.
interface FromFSOptions {
contentType?: string,
fileName?: string
}
interface File {
readonly contentType: string | null
readonly fileName: string
getContent: () => Promise<Buffer>
}