About
Take a screenshot of the active display in .png
Example
import { screenshot } from "@xan105/screenshot";
screenshot("./path/to/file.png").then(console.log).catch(console.error);
Install
npm install @xan105/screenshot
API
Previous version(s) are CommonJS (CJS) with an ESM wrapper.
Named export
screenshot(filePath: string, overwrite?: boolean): Promise<string>
Take a screenshot in .png at given location.
Doesn't overwrite if it already exists (default) unless you set overwrite to true.
Returns png filepath.
NB: filepath extension will be enforced to '.png'