Take a screenshot of the active display in .png
import { screenshot } from "@xan105/screenshot";
screenshot("./path/to/file.png").then(console.log).catch(console.error);
npm install @xan105/screenshot
Previous version(s) are CommonJS (CJS) with an ESM wrapper.
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'