index.js
function downloadVisualizationData(_visJson, destDir, callback) {
    if (destDir === undefined) destDir = '.';

    withVisJson(_visJson, function (err, visJson) {
        if (err && callback) return callback(err);
        _async2['default'].forEachOf(visJson.layers, function (layer, layerIndex, callback) {
            if (layer.type === 'namedmap') {
                console.error("Layer is not public, cannot download its data. If you own the map and datasets, please change the privacy settings to 'public' and try again.");
                return callback();
            }
            if (layer.type !== 'layergroup') {
                if (callback) callback();
                return;
            }
            _async2['default'].forEachOf(layer.options.layer_definition.layers, function (sublayer, sublayerIndex, callback) {
                var dest = _path2['default'].join(sublayerDir(destDir, layerIndex, sublayerIndex), 'layer.geojson');
                downloadSublayerData(visJson, layerIndex, sublayerIndex, dest, callback);
            }, callback);
        }, callback);
    });
}
function downloadVisualizationData(_visJson, destDir, callback) {
    if (destDir === undefined) destDir = '.';

    withVisJson(_visJson, function (err, visJson) {
        if (err && callback) return callback(err);
        _async2['default'].forEachOf(visJson.layers, function (layer, layerIndex, callback) {
            if (layer.type === 'namedmap') {
                console.error("Layer is not public, cannot download its data. If you own the map and datasets, please change the privacy settings to 'public' and try again.");
                return callback();
            }
            if (layer.type !== 'layergroup') {
                if (callback) callback();
                return;
            }
            _async2['default'].forEachOf(layer.options.layer_definition.layers, function (sublayer, sublayerIndex, callback) {
                var dest = _path2['default'].join(sublayerDir(destDir, layerIndex, sublayerIndex), 'layer.geojson');
                downloadSublayerData(visJson, layerIndex, sublayerIndex, dest, callback);
            }, callback);
        }, callback);
    });
}
function downloadVisualizationData ( _visJson , destDir , callback ) { if ( destDir === undefined ) destDir = '.' ; withVisJson ( _visJson , function ( err , visJson ) { if ( err && callback ) return callback ( err ) ; _async2 [ 'default' ] . forEachOf ( visJson . layers , function ( layer , layerIndex , callback ) { if ( layer . type === 'namedmap' ) { console . error ( "Layer is not public, cannot download its data. If you own the map and datasets, please change the privacy settings to 'public' and try again." ) ; return callback ( ) ; } if ( layer . type !== 'layergroup' ) { if ( callback ) callback ( ) ; return ; } _async2 [ 'default' ] . forEachOf ( layer . options . layer_definition . layers , function ( sublayer , sublayerIndex , callback ) { var dest = _path2 [ 'default' ] . join ( sublayerDir ( destDir , layerIndex , sublayerIndex ) , 'layer.geojson' ) ; downloadSublayerData ( visJson , layerIndex , sublayerIndex , dest , callback ) ; } , callback ) ; } , callback ) ; } ) ; }
Download the layer data for a visualization.

@param {Object|String} visJson the visualization's JSON or the url where it
can be found
@param {String} destDir the base directory where the data should be saved
Download the layer data for a visualization .