Created
May 23, 2021 01:51
-
-
Save Iainmon/70653a00c40e699df10564b5d72f1fcb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sharp = require('sharp'); | |
const fs = require('fs').promises; | |
const SVG = require('@svgdotjs/svg.js'); | |
const main = async () => { | |
const buffer = await fs.readFile(__dirname + '/dist/img/sprites/svg/bella-day.svg'); | |
// sharp(buffer).resize().toFormat('png').toFile('bella.png'); | |
const bufferString = buffer.toString(); | |
const draw = SVG.SVG(); | |
const out = draw.svg(bufferString); | |
console.log(out); | |
}; | |
main(); | |
// http://snapsvg.io/docs/ | |
// https://www.npmjs.com/package/svg.js | |
// https://stackoverflow.com/questions/36133657/is-there-a-way-to-make-svg-js-work-with-node-js/50743220 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment