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

ipfs-block-service

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-block-service - npm Package Compare versions

Comparing version 0.9.1 to 0.10.0

20

dist/index.js

@@ -104,3 +104,3 @@ var IpfsBlockService =

*/
goOnline (bitswap) {
setExchange (bitswap) {
this._bitswap = bitswap

@@ -114,3 +114,3 @@ }

*/
goOffline () {
unsetExchange () {
this._bitswap = null

@@ -124,3 +124,3 @@ }

*/
isOnline () {
hasExchange () {
return this._bitswap != null

@@ -137,7 +137,7 @@ }

put (block, callback) {
if (this.isOnline()) {
if (this.hasExchange()) {
return this._bitswap.put(block, callback)
}
this._repo.blockstore.put(block, callback)
this._repo.blocks.put(block, callback)
}

@@ -153,7 +153,7 @@

putMany (blocks, callback) {
if (this.isOnline()) {
if (this.hasExchange()) {
return this._bitswap.putMany(blocks, callback)
}
this._repo.blockstore.putMany(blocks, callback)
this._repo.blocks.putMany(blocks, callback)
}

@@ -169,7 +169,7 @@

get (cid, callback) {
if (this.isOnline()) {
if (this.hasExchange()) {
return this._bitswap.get(cid, callback)
}
return this._repo.blockstore.get(cid, callback)
return this._repo.blocks.get(cid, callback)
}

@@ -185,3 +185,3 @@

delete (cid, callback) {
this._repo.blockstore.delete(cid, callback)
this._repo.blocks.delete(cid, callback)
}

@@ -188,0 +188,0 @@ }

@@ -1,1 +0,1 @@

var IpfsBlockService=function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.i=function(value){return value},__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=1)}([function(module,exports,__webpack_require__){"use strict";class BlockService{constructor(ipfsRepo){this._repo=ipfsRepo,this._bitswap=null}goOnline(bitswap){this._bitswap=bitswap}goOffline(){this._bitswap=null}isOnline(){return null!=this._bitswap}put(block,callback){if(this.isOnline())return this._bitswap.put(block,callback);this._repo.blockstore.put(block,callback)}putMany(blocks,callback){if(this.isOnline())return this._bitswap.putMany(blocks,callback);this._repo.blockstore.putMany(blocks,callback)}get(cid,callback){return this.isOnline()?this._bitswap.get(cid,callback):this._repo.blockstore.get(cid,callback)}delete(cid,callback){this._repo.blockstore.delete(cid,callback)}}module.exports=BlockService},function(module,exports,__webpack_require__){module.exports=__webpack_require__(0)}]);
var IpfsBlockService=function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.i=function(value){return value},__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=1)}([function(module,exports,__webpack_require__){"use strict";class BlockService{constructor(ipfsRepo){this._repo=ipfsRepo,this._bitswap=null}setExchange(bitswap){this._bitswap=bitswap}unsetExchange(){this._bitswap=null}hasExchange(){return null!=this._bitswap}put(block,callback){if(this.hasExchange())return this._bitswap.put(block,callback);this._repo.blocks.put(block,callback)}putMany(blocks,callback){if(this.hasExchange())return this._bitswap.putMany(blocks,callback);this._repo.blocks.putMany(blocks,callback)}get(cid,callback){return this.hasExchange()?this._bitswap.get(cid,callback):this._repo.blocks.get(cid,callback)}delete(cid,callback){this._repo.blocks.delete(cid,callback)}}module.exports=BlockService},function(module,exports,__webpack_require__){module.exports=__webpack_require__(0)}]);
{
"name": "ipfs-block-service",
"version": "0.9.1",
"version": "0.10.0",
"description": "JavaScript Implementation of BlockService",

@@ -41,8 +41,8 @@ "main": "src/index.js",

"aegir": "^11.0.2",
"async": "^2.4.1",
"chai": "^3.5.0",
"async": "^2.5.0",
"chai": "^4.0.2",
"cids": "^0.5.0",
"dirty-chai": "^1.2.2",
"dirty-chai": "^2.0.0",
"ipfs-block": "~0.6.0",
"ipfs-repo": "~0.13.1",
"ipfs-repo": "~0.15.0",
"lodash": "^4.17.4",

@@ -63,2 +63,3 @@ "multihashing-async": "^0.4.5",

"Greenkeeper <support@greenkeeper.io>",
"Pedro Teixeira <i@pgte.me>",
"Richard Littauer <richard.littauer@gmail.com>",

@@ -65,0 +66,0 @@ "Stephen Whitmore <stephen.whitmore@gmail.com>",

@@ -30,3 +30,3 @@ 'use strict'

*/
goOnline (bitswap) {
setExchange (bitswap) {
this._bitswap = bitswap

@@ -40,3 +40,3 @@ }

*/
goOffline () {
unsetExchange () {
this._bitswap = null

@@ -50,3 +50,3 @@ }

*/
isOnline () {
hasExchange () {
return this._bitswap != null

@@ -63,7 +63,7 @@ }

put (block, callback) {
if (this.isOnline()) {
if (this.hasExchange()) {
return this._bitswap.put(block, callback)
}
this._repo.blockstore.put(block, callback)
this._repo.blocks.put(block, callback)
}

@@ -79,7 +79,7 @@

putMany (blocks, callback) {
if (this.isOnline()) {
if (this.hasExchange()) {
return this._bitswap.putMany(blocks, callback)
}
this._repo.blockstore.putMany(blocks, callback)
this._repo.blocks.putMany(blocks, callback)
}

@@ -95,7 +95,7 @@

get (cid, callback) {
if (this.isOnline()) {
if (this.hasExchange()) {
return this._bitswap.get(cid, callback)
}
return this._repo.blockstore.get(cid, callback)
return this._repo.blocks.get(cid, callback)
}

@@ -111,3 +111,3 @@

delete (cid, callback) {
this._repo.blockstore.delete(cid, callback)
this._repo.blocks.delete(cid, callback)
}

@@ -114,0 +114,0 @@ }

Sorry, the diff of this file is not supported yet

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