Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svgsaver

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svgsaver

download an SVG element with css styles

  • 0.9.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.2K
decreased by-0.16%
Maintainers
1
Weekly downloads
 
Created
Source

svgsaver

Download an SVG element as an SVG or PNG file, including CSS defined styles.

NPM version Downloads Downloads

Build Status Codacy Badge

js-semistandard-style License

Features

  • Download <svg> by element object.
  • Download as SVG or PNG file.
  • Copies SVG element styles as rendered in the browser, including styles defined in CSS style sheets.
  • Copies only SVG relevant and non-default styles. See here.
  • Computed styles are in-lined for maximum compatibility.

Install

Node

npm install svgsaver

Bower

bower install svgsaver

JSPM

jspm install svgsaver=npm:svgsaver

Usage

For maximum compatibility across browsers include eligrey/FileSaver.js/ and eligrey/canvas-toBlob.js. See Compatibility-Chart for more information.

Example

var SvgSaver = require('svgsaver');                 // if using CommonJS environment
var svgsaver = new SvgSaver();                      // creates a new instance
var svg = document.querySelector('#mysvg');         // find the SVG element
svgsaver.asSvg(svg);                                // save as SVG

Demos

Acknowledgments

Based on previous work on Hypercubed/angular-downloadsvg-directive. Some portions of this code inspired by raw and moagrius/copycss.

License

MIT License

Keywords

FAQs

Package last updated on 08 May 2017

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