1.1.1 • Published 3 years ago

svg-attrs v1.1.1

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

svg-attrs

Get attributes of a svg.

Installation

npm i -D svg-attrs
# or
yarn add --dev svg-attrs

Usage

Get attributes from a svg file path

const svgAttrs = require('svg-attrs')

svgAttrs.file('./test.svg', (err, attrs) => {
    if (err) {
        console.error(err)
    } else {
        let width = attrs.width
        let height = attrs.height
        
        let attrs = attrs.attrs
    }
})

Get attributes from a svg string

const svgAttrs = require('svg-attrs')

svgAttrs.string('svg string', (err, attrs) => {
    if (err) {
        console.error(err)
    } else {
        let width = attrs.width
        let height = attrs.height
        
        let attrs = attrs.attrs
    }
})

License

MIT