Comparing version 1.0.0 to 1.0.1-1
26
index.js
@@ -137,2 +137,17 @@ var fs = require('fs'); | ||
function bufferStream(cb) { | ||
if(!cb) cb = function(){}; | ||
return function(err, stream) { | ||
if(err || !stream) return cb(err); | ||
var bufs = []; | ||
stream.on('data', function(chunk) { | ||
bufs.push(chunk); | ||
}); | ||
stream.on('error', cb); | ||
stream.on('end', function() { | ||
cb(null, Buffer.concat(bufs)); | ||
}); | ||
} | ||
} | ||
return { | ||
@@ -152,3 +167,5 @@ send: send, | ||
}, | ||
show: command('config/show'), | ||
show: function(cb) { | ||
send('config/show', null, null, null, bufferStream(cb)); | ||
}, | ||
replace: function(file, cb) { | ||
@@ -209,2 +226,9 @@ send('config/replace', null, null, file, cb) | ||
}, | ||
ping: function(id, cb) { | ||
send('ping', id, { n: 1 }, null, function(err, res) { | ||
if(err) return cb(err, null); | ||
cb(null, res[1]); | ||
}); | ||
}, | ||
id: function(id, cb) { | ||
@@ -211,0 +235,0 @@ if(typeof id === 'function') { |
var ipfs = require('./')('localhost', 5001); | ||
ipfs.cat('QmeZy1fGbwgVSrqbfh9fKQrAWgeyRnj7h8fsHS1oy3k99x/beep/boop', function(err, data) { | ||
data.on('data', function(chunk){ | ||
console.log(chunk.toString()) | ||
}); | ||
ipfs.add(new Buffer('hello world'), function(err, data) { | ||
console.log(err, data) | ||
}); |
{ | ||
"name": "ipfs-api", | ||
"version": "1.0.0", | ||
"version": "1.0.1-1", | ||
"description": "An client library for the IPFS API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
6903
230
0
3