Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ipfs-api

Package Overview
Dependencies
Maintainers
1
Versions
177
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-api - npm Package Compare versions

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') {

6

main.js
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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc