Skip to content

Tego Bot API Documentation v0.2.0


Tego Bot API Documentation / captureScreen

Function: captureScreen()

captureScreen(): Promise<ScreenCapture>

Defined in: botjs/src/index.ts:412

Capture the entire screen as a PNG image

Returns

Promise<ScreenCapture>

Promise resolving to screen capture with PNG buffer

Example

typescript
import { captureScreen } from "@tego/botjs";
import fs from "fs";

const screenshot = await captureScreen();
fs.writeFileSync('screenshot.png', screenshot.image);
console.log(`Captured ${screenshot.width}x${screenshot.height} screenshot`);

Released under the MIT License.