Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including buncher with all npm packages installed. Try it out:

var buncher = require("buncher")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

buncher v1.0.2

node.js module that collects remote data from different sources and can check it with JSON Schema


buncher collects data from different sources and accumulates it into one object. It will not return keys for incorrect items: incorrect URL, code is not 200, invalid data. These keys will be in err object.


    { name: 'name1', url: "http://url-to.json", schema: 'tests/schema/name.json' },
    // type 'plain' means it will not be parsed as JSON
    { name: 'name2', url: "http://url-to.html/xml", type: 'plain' }
], function( err, results ) {
    console.log( results.name1 );   // parsed and checked JSON from name1
    console.log( results.name2 );   // plain HTML from name2


get( links, callback[, options ] )


Type: Array

Array of objects with URLs to get data from:

    "name"    : "String, required. Property name in result object",
    "url"     : "Srting, required. URL to get data from",
    "type"    : "String, optional. Set it to 'plain', if the result shouldn't be parsed as JSON",
    "schema"  : "String, optional. Path to file with JSON Schema. Absolute or relative from process working directory, e.g. server.js",
    "timeout" : "Number, optional. Request timeout for this exact link"


Type: Function

Gets err and results aas arguments. err contains errors in err[ ].errors array and results contains data in results[ ].


Type: Object


    "timeout"  : "Number. HTTP request timeout. Default is 5000. Can be redefined for links",
    "request"  : "Object. 'Request' object to get cookies from",
    "oninvalid": function( link, validationResult ) {
        // called on every validation error
        // send email, for example
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free