# svg-reader

> sync read svg icons and parse to icons object

Latest version **0.2.0** (published 2017-02-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install svg-reader
pnpm add svg-reader
yarn add svg-reader
bun add svg-reader
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-02-27 |
| First published | 2016-07-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ZHAO Xudong |
| Maintainers | zxdong262 |
| Keywords | svg-reader, svg |

## Links

- npm: https://www.npmjs.com/package/svg-reader
- Repository: https://github.com/zxdong262/svg-reader
- Issues: https://github.com/zxdong262/svg-reader/issues
- npm.io page: https://npm.io/package/svg-reader

## Dependencies (1)

- [cheerio](https://npm.io/package/cheerio.md) ^0.20.0

## Recent versions

- 0.2.0 (latest) — 2017-02-27
- 0.1.0 — 2016-07-02
- 0.0.2 — 2016-07-02
- 0.0.1 — 2016-07-02

## README

# svg-reader
[![Build Status](https://travis-ci.org/zxdong262/svg-reader.svg?branch=master)](https://travis-ci.org/zxdong262/svg-reader)

sync read svg icons and parse to icons object


## get
```bash
npm install svg-reader
```

## use

```javascript

const read = require('svg-reader')
var icons = read(__dirname + '/icons.svg')

/*
icons = 
{ home: 
   { name: 'home',
     width: 928,
     height: 1000,
     path: 'M786 ... 12t-4-13z',
     ascent: 850,
     svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 928 1000"><g transform="scale(1,-1) translate(0 -850)"><path d="M78 ... 4-13z"/></g></svg>' },
  link: 
   { name: 'link',
     width: 928,
     height: 1000,
     path: 'M81 ... 14z',
     ascent: 850,
     svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 928 1000"><g transform="scale(1,-1) translate(0 -850)"><path d="M81 ... 114z"/></g></svg>' },
  unlink: 
   { name: 'unlink',
     width: 928,
     height: 1000,
     path: 'M24 ... 13z',
     ascent: 850,
     svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 928 1000"><g transform="scale(1,-1) translate(0 -850)"><path d="M24 ... 5-13z"/></g></svg>' }
}

*/

//if do not need svg,  pass a option { nosvg: true } 
var icons = read(__dirname + '/icons.svg', { nosvg: true })
/*
icons = 
{ home: 
   { name: 'home',
     width: 928,
     height: 1000,
     path: 'M786 ... 12t-4-13z',
     ascent: 850},
  link: 
   { name: 'link',
     width: 928,
     height: 1000,
     path: 'M81 ... 14z',
     ascent: 850},
  unlink: 
   { name: 'unlink',
     width: 928,
     height: 1000,
     path: 'M24 ... 13z',
     ascent: 850}
}

*/
```


## test
```bash
git clone git@github.com:zxdong262/svg-reader.git
cd svg-reader
npm i
npm run test
```

## License
MIT

---
_Source: https://npm.io/package/svg-reader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
