New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

canvas-screenshot

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-screenshot

A one trick pony package to download an image from a canvas.

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
90
decreased by-18.18%
Maintainers
1
Weekly downloads
 
Created
Source

canvas-screenshot stable

npm version styled with prettier

A one trick pony package to download an image from a canvas.

Installation

npm install canvas-screenshot

NPM

Usage

const canvasScreenshot = require("canvas-screenshot");
const createCanvasContext = require("canvas-context");

const { context } = createCanvasContext("2d", {
  width: 100,
  height: 100
});

const button = document.createElement("button");
button.addEventListener("click", () => {
  canvasScreenshot(context.canvas);
});

API

canvasScreenshot(canvas, options): DOMString | Promise<Blob>

Returns a Data URI or a Promise resolving with a Blob. Setting useBlob to true will consequently make the module async and return the latter.

OptionTypeDefaultDescription
canvasHTMLCanvasElementThe canvas element
options.filenamestring?Screen Shot YYYY-MM-DD at HH.MM.SS.pngFile name
options.qualitynumber?1Quality between 0 and 1
options.useBlobboolean?undefinedUse canvas.toBlob
options.downloadboolean?trueAutomatically download the screenshot

Type is inferred from the filename extension (jpg/jpeg) for "image/jpeg" and default to "image/png".

License

MIT. See license file.

Keywords

FAQs

Package last updated on 06 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc