node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


DataPackage Query


Opens datapackage.json and contained resource.csv files and performs various search queries on the contents.

npm install datapackage-query

Getting Started

Include package and perform a basic query with arguments. In this case the arguments are the type key and search

var Query = require('datapackage-query')
var arguments = { country: 'SY', 'search': 'DarkCo' }
Query.Grow('/path/to/your/datapackage.json', function(schema) {
  Query.Twirl('/path/to/datapackage/', schema.resources[0], arguments, function(csv_to_json_data) {
    // use your data for good :)


search filters results by wild card search term specified

key filters results by "key" in a datapackage's schema to the specified value of query


Here is an example of datapackage-query being used to power website which creates a REST API using ConjurorAPI which exposes the data through the Hapi.js webserver.

Example: retrieve all surveillance vendors based in Germany:

curl "" | python -m json.tool

Example: retrieve all targeted attacks related to Syria that have employed the DarkComet RAT:

curl "" | python -m json.tool
curl "" | python -m json.tool

REST API Query Result

$ curl | python -m json.tool
    "description": "Targeted attacks related to civil society",
    "homepage": "",
    "license": "PDDL-1.0",
    "name": "data-targetedthreats",
    "repository": "",
    "result": [
            "c2": "",
            "country": "ET",
            "date": "2012-01-01",
            "family": "FinSpy",
            "md5": "8ae2febe04102450fdbc26a38037c82b",
            "reference": "",
            "target": "opposition"
            "c2": "",
            "country": "ET",
            "date": "2013-12-01",
            "family": "RCS",
            "md5": "53a9e1b59ff37cc2aeff0391cc546201",
            "reference": "",
            "target": "journalist"
    "status": "success",
    "title": "Targeted Threats",
    "version": "0.1.0"