0.2.0 • Published 11 years ago
feeder v0.2.0
feeder
Introduction
This project is a simple xml to json converter for the most common types of ecommerce product feeds.
Dependencies
Usage
var FeedStream = require('feeder')
, fs = require('fs');
fs.createReadStream('feed.xml')
.pipe(new FeedStream())
.pipe(process.stdout);Options
newlines-Booleanprint each product on a new linetrim-Booleantrim element textblacklist-Arrayblacklist keys from being emittedrename-Objectrename keys e.g.{"before": "after"}lowercaseKeys-Booleanlower case keysproductElement-Stringelement name to mark the start and end of a product. Usually 'product' or some variation thereofextractAttrs-Booleanextract all element attributes into emitted objects
Example
FeedStream accepts xml of approximately the following format:
<products>
<product>
<name> Wintermute </name>
<price> 2000.00 </price>
<currency> CHF </price>
</product>
<product>
<name> Neuromancer </name>
<price> 100000.00 </price>
<currency> BRL </currency>
</product>
</products>and produces a stringified JSON object for each product:
{ name: 'Wintermute', price: '2000.00', currency: 'CHF' }
{ name: 'Neuromancer', price: '100000.00', currency: 'BRL'}License
MIT