Just use npm:
npm install jsawk
It auto install jsawk in node_modules and then you can use it in your script:
var jsawk = require('jsawk');
But why are you using curl from shell, there are better ways to get http data, the basic is http request
var https = require('https');
var options = {
host: 'api.github.com',
path: '/repos/jquery/jquery/tags',
port: 443,
method: 'GET',
headers: {'User-Agent': 'nodejstestagent'}
};
var req = https.get(options, function(res) {
console.log('STATUS: ' + res.statusCode);
console.log('HEADERS: ' + JSON.stringify(res.headers));
// Buffer the body entirely for processing as a whole.
var bodyChunks = [];
res.on('data', function(chunk) {
// You can process streamed parts here...
bodyChunks.push(chunk);
}).on('end', function() {
var body = Buffer.concat(bodyChunks);
var jsonResponse = JSON.parse( body) ;
console.log( JSON.stringify( jsonResponse,null,3 ));
})
});
req.on('error', function(e) {
console.log('ERROR: ' + e.message);
});
Will output something like this:
[
{
"name": "2.1.1-rc2",
"zipball_url": "https://api.github.com/repos/jquery/jquery/zipball/2.1.1-rc2",
"tarball_url": "https://api.github.com/repos/jquery/jquery/tarball/2.1.1-rc2",
"commit": {
"sha": "c2fdcaaacd4d7f8479b2196525330c1738e30cd3",
"url": "https://api.github.com/repos/jquery/jquery/commits/c2fdcaaacd4d7f8479b2196525330c1738e30cd3"
}
},
{
"name": "2.1.1-rc1",
"zipball_url": "https://api.github.com/repos/jquery/jquery/zipball/2.1.1-rc1",
"tarball_url": "https://api.github.com/repos/jquery/jquery/tarball/2.1.1-rc1",
"commit": {
"sha": "6ba4c8def1f9b0d03c5e8de1d64a78ae36646fb6",
"url": "https://api.github.com/repos/jquery/jquery/commits/6ba4c8def1f9b0d03c5e8de1d64a78ae36646fb6"
}
},
Updated for https and github rule for User-Agent