Skip to main content
Each screenshot class is instantiated with new and exposes capture(options)Promise<Buffer> (image bytes).

UrlScreenshot

import { UrlScreenshot } from "chromiumly";

const screenshot = new UrlScreenshot();
const buffer = await screenshot.capture({
  url: string;  // required
  // + ScreenshotOptions (properties, wait*, extraHttpHeaders, etc.)
});

HtmlScreenshot

import { HtmlScreenshot } from "chromiumly";

const screenshot = new HtmlScreenshot();
const buffer = await screenshot.capture({
  html: PathLikeOrReadStream;  // required
  // + ScreenshotOptions
});

MarkdownScreenshot

import { MarkdownScreenshot } from "chromiumly";

const screenshot = new MarkdownScreenshot();
const buffer = await screenshot.capture({
  html: PathLikeOrReadStream;     // required
  markdown: PathLikeOrReadStream; // required
  header?: PathLikeOrReadStream;
  footer?: PathLikeOrReadStream;
  // + other ScreenshotOptions
});

Screenshot options

  • propertiesImageProperties: format ("png" | "jpeg" | "webp"), quality (0–100, JPEG), omitBackground, width, height, clip
  • waitDelay, waitForSelector, waitForExpression
  • extraHttpHeaders, failOnHttpStatusCodes, failOnConsoleExceptions, failOnResourceHttpStatusCodes, ignoreResourceHttpStatusDomains, failOnResourceLoadingFailed, skipNetworkIdleEvent
  • optimizeForSpeed — favor encoding speed over output size
  • cookies, downloadFrom, userPassword, ownerPassword, embeds
See Types for ImageProperties and related types.