svg-attrs

1.1.1 • Public • Published

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

Package Sidebar

Install

npm i svg-attrs

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

9.51 kB

Total Files

6

Last publish

Collaborators

  • codesinging