lib/ckan-exporter.js
function getPackageSet(index, callback) {
	var page = {
		limit  : 100,
		offset : index*100
	}

	ckan.exec('current_package_list_with_resources', page, function(err, resp){
		checkError(err, resp);
		
		for( var i = 0; i < resp.result.length; i++ ) {
			data.packages[resp.result[i].id] = resp.result[i];
		}

		if( resp.result.length == 0 ) {
			if( callback ) callback();
		} else {
			if( options.debug ) console.log("CKAN EXPORT: Package data loaded ("+(index*100)+" to "+((index+1)*100)+")");
			index++;
			getPackageSet(index, callback);
		}
	});
}
function getPackageSet(index, callback) {
	var page = {
		limit  : 100,
		offset : index*100
	}

	ckan.exec('current_package_list_with_resources', page, function(err, resp){
		checkError(err, resp);
		
		for( var i = 0; i < resp.result.length; i++ ) {
			data.packages[resp.result[i].id] = resp.result[i];
		}

		if( resp.result.length == 0 ) {
			if( callback ) callback();
		} else {
			if( options.debug ) console.log("CKAN EXPORT: Package data loaded ("+(index*100)+" to "+((index+1)*100)+")");
			index++;
			getPackageSet(index, callback);
		}
	});
}
function getPackageSet ( index , callback ) { var page = { limit : 100 , offset : index * 100 } ckan . exec ( 'current_package_list_with_resources' , page , function ( err , resp ) { checkError ( err , resp ) ; for ( var i = 0 ; i < resp . result . length ; i ++ ) { data . packages [ resp . result [ i ] . id ] = resp . result [ i ] ; } if ( resp . result . length == 0 ) { if ( callback ) callback ( ) ; } else { if ( options . debug ) console . log ( "CKAN EXPORT: Package data loaded (" + ( index * 100 ) + " to " + ( ( index + 1 ) * 100 ) + ")" ) ; index ++ ; getPackageSet ( index , callback ) ; } } ) ; }
get 100 packages at a time
get 100 packages at a time