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

oslllo-svg2

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oslllo-svg2

Convert a SVG to multiple image formats (without puppeteer or a headless browser)

  • 4.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Cover Image

CI/Test npm Coverage Status

🎉 v1.0.0 Removed Canvas & JSDOM no more slow npm install cycles.

Documentation, Installation, and Usage Instructions

See the full installation and usage documentation HERE.

The Objective

I wanted to convert SVGs into diffrent image formats.

The Problem / Why

Converting a SVG into an image turns out to not be a simple and straight forward as it may seem. Multiple packages already exist on NPM but they all come with a few caveats (that i don't like).

  • Some use puppeteer which requires you to download a browser like chromium (130mb download)
  • Some do not support Node (work in browsers only)
  • Some support CLI only.
  • Some only convert to png

Usage Examples

Convert a SVG2 png and save to path (promise)
const Svg2 = require("oslllo-svg2");

Svg2("path/to/svg/example.svg")
  .png()
  .toFile("path/to/save/example.png")
  .then(() => {
    console.log("done");
  })
  .catch((error) => {
    throw error;
  });
Convert a SVG2 png and save to path (callback)
const Svg2 = require("oslllo-svg2");

Svg2("path/to/svg/example.svg")
  .png()
  .toFile("path/to/save/example.png", (err) => {
    if (err) {
      throw err;
    } else {
      console.log("done");
    }
  });

Keywords

FAQs

Package last updated on 21 Nov 2024

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