Home Reference Source Test

fzp-js

The fritzing fzp javascript library is for processing fritzing fzp xml data.
The Library can be used to load fzp's, parse and marshal to XML.

Installation

Install the npm package

npm install fritzing/fzp-js --save

or use yarn to install and add the dependency to your package.json

yarn add fritzing/fzp-js

Usage

Let's start with a simple szenario and load a fzp file and all svg's.
Documentation of the library can be found here

const {FZPUtils} = require('fzp-js')

const url = 'https://fritzing.github.io/fritzing-parts/core/LED-generic-3mm.fzp'
FZPUtils.loadFZP(url).then((fzp) => {
  console.log('FZP', fzp);

  // load the svg of the breadboard view
  fzp.views.breadboard.loadSVG('foo').then((d) => {
    console.log('SVG', d);
  }).catch((err) => {
    throw new Error(err)
  })

}).catch((e) => {
  throw new Error(err)
})

Development

yarn install
make test

and lint your files before you commit

make lint

to build an es5 compatible version run

make build

License

MIT-LICENSE