{"_id":"svg-to-dataurl","_rev":"2-17eae9b2472c873ec822398b1be96a90","name":"svg-to-dataurl","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"svg-to-dataurl","main":"svg-to-dataurl","version":"1.0.0","description":"😹 convert SVGs to DataURLs","license":"MIT","repository":{"type":"git","url":"git+https://github.com/F1LT3R/svg-to-dataurl.git"},"author":{"name":"F1LT3R","email":"al@pwn.io","url":"f1lt3r.io"},"scripts":{"test":"xo && yarn run cover","unit":"ava","watch":"ava --watch","cover":"nyc --reporter=lcov --reporter=html --reporter=text ava *.test.js","coveralls":"cat ./coverage/lcov.info | ./node_modules/.bin/coveralls -v"},"husky":{"hooks":{"pre-commit":"yarn test"}},"files":["index.js"],"keywords":["svg","svg-to-dataurl","data","url","data-url","dataurl","data-uri","datauri","encode","base64"],"dependencies":{},"devDependencies":{"ava":"^0.25.0","coveralls":"^3.0.0","husky":"^0.15.0-rc.13","nyc":"^11.6.0","xo":"^0.20.3"},"nyc":{"reporter":["lcov","text"]},"xo":{"esnext":true,"semicolon":false,"globals":["__dirname"],"rules":{"no-console":1,"space-before-function-paren":0}},"ava":{"failFast":true},"gitHead":"30b96c68cd55c2cdb9ccbe4f49c064634c302dbb","bugs":{"url":"https://github.com/F1LT3R/svg-to-dataurl/issues"},"homepage":"https://github.com/F1LT3R/svg-to-dataurl#readme","_id":"svg-to-dataurl@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"f1lt3r","email":"al@pwn.io"},"dist":{"integrity":"sha512-WrPB9vdd4RO0BjcPN6NJ9ofj3Zt8de16TJZ+JVJ4LnE2OKNGz+HjgGv6rE5Hp3s+OnM56X9i64mfJDU9uf4ZqQ==","shasum":"343f21a5dc3e051ae413c590cf478b7cf7a5f070","tarball":"https://registry.npmjs.org/svg-to-dataurl/-/svg-to-dataurl-1.0.0.tgz","fileCount":4,"unpackedSize":4015,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCv/l5o3gVX6XIWThmwQ/CvUAWfTh2Ky62ZHkJD3icdpQIgNT5rgXo8UknBihHfZV/4n4FBVZYCBLJTGauyimNyWK8="}]},"maintainers":[{"name":"f1lt3r","email":"al@pwn.io"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/svg-to-dataurl_1.0.0_1523392531135_0.3237288620358978"},"_hasShrinkwrap":false}},"time":{"created":"2018-04-10T20:35:31.134Z","1.0.0":"2018-04-10T20:35:31.223Z","modified":"2022-05-19T03:39:04.682Z"},"maintainers":[{"name":"f1lt3r","email":"al@pwn.io"}],"description":"😹 convert SVGs to DataURLs","homepage":"https://github.com/F1LT3R/svg-to-dataurl#readme","keywords":["svg","svg-to-dataurl","data","url","data-url","dataurl","data-uri","datauri","encode","base64"],"repository":{"type":"git","url":"git+https://github.com/F1LT3R/svg-to-dataurl.git"},"author":{"name":"F1LT3R","email":"al@pwn.io","url":"f1lt3r.io"},"bugs":{"url":"https://github.com/F1LT3R/svg-to-dataurl/issues"},"license":"MIT","readme":"# svg-to-dataurl\n\n> 😹 convert SVGs to DataURLs\n\n[![Build Status](https://travis-ci.org/F1LT3R/svg-to-dataurl.svg?branch=master)](https://travis-ci.org/F1LT3R/svg-to-dataurl)\n[![Coverage Status](https://coveralls.io/repos/github/F1LT3R/svg-to-dataurl/badge.svg?branch=master)](https://coveralls.io/github/F1LT3R/svg-to-dataurl?branch=master)\n[![NPM Version](https://img.shields.io/npm/v/svg-to-dataurl.svg)](https://www.npmjs.com/package/svg-to-dataurl)\n[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)\n\n## Install\n\n```\n$ yarn add svg-to-dataurl\n```\n\n## Usage\n\nWhere `svgStr` is a string of SVG content, like this:\n\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<svg version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n\t\t<circle cx=\"50\" cy=\"50\" r=\"40\" stroke=\"black\" stroke-width=\"3\" fill=\"red\" />\n</svg>\n```\n\nYou can convert the string to a DataURL with `svgToDataURL()`:\n\n```js\nconst svgToDataURL = require('svg-to-dataurl')\nconst dataUrl = svgToDataURL(svgStr)\n\nconsole.log(dataUrl)\n// data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20r%3D%2240%22%20stroke%3D%22black%22%20stroke-width%3D%223%22%20fill%3D%22red%22%20%2F%3E%3C%2Fsvg%3E\n```\n\n## Visual Confirmation\n\nYou can test the string works by pasting the output into the address bar of your web browser:\n\n![Browser Example](browser-example.png)\n","readmeFilename":"README.md"}