Skip to content

Tego Bot API Documentation v0.2.0


Tego Bot API Documentation / captureAndSave

Function: captureAndSave()

captureAndSave(path, region?, options?): Promise<void>

Defined in: botjs/src/screenshot.ts:542

Capture and save screenshot in one call

Parameters

path

string

Output file path

region?

ScreenRegion

Optional region to capture

options?

SaveImageOptions

Save options

Returns

Promise<void>

Example

typescript
// Full screen
await captureAndSave('screenshot.png');

// Region
await captureAndSave('region.jpg', { x: 0, y: 0, width: 800, height: 600 }, {
  quality: 90
});

Released under the MIT License.