Skip to content

Instantly share code, notes, and snippets.

@fraserxu
Created February 5, 2015 03:22
Show Gist options
  • Save fraserxu/c5a65a19f5f10a9c518d to your computer and use it in GitHub Desktop.
Save fraserxu/c5a65a19f5f10a9c518d to your computer and use it in GitHub Desktop.
svg pattern generator
var btoa = require('btoa')
var fs = require('fs')
var pattern = fs.readFileSync('test.svg', { encoding: 'utf-8'})
var b64 = btoa(pattern)
var b64 = "data:image/svg+xml;base64," + b64
console.log(b64)
Display the source blob
Display the rendered blob
Raw
<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10'>
<g style="fill: none; stroke: rgb(255, 255, 255);">
<circle cx="5" cy="5" r="1"></circle>
</g>
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment