Socket
Socket
Sign inDemoInstall

ipfs-block-service

Package Overview
Dependencies
2
Maintainers
2
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.17.0 to 0.17.1

.github/ISSUE_TEMPLATE/config.yml

10

CHANGELOG.md

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

<a name="0.17.1"></a>
## [0.17.1](https://github.com/ipfs/js-ipfs-block-service/compare/v0.17.0...v0.17.1) (2020-05-05)
### Features
* add deleteMany method ([#92](https://github.com/ipfs/js-ipfs-block-service/issues/92)) ([c57e26f](https://github.com/ipfs/js-ipfs-block-service/commit/c57e26f))
<a name="0.17.0"></a>

@@ -2,0 +12,0 @@ # [0.17.0](https://github.com/ipfs/js-ipfs-block-service/compare/v0.16.0...v0.17.0) (2020-04-16)

76

dist/index.js

@@ -111,2 +111,20 @@ (function webpackUniversalModuleDefinition(root, factory) {

function _awaitAsyncGenerator(value) { return new _AwaitValue(value); }
function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; }
function _AsyncGenerator(gen) { var front, back; function send(key, arg) { return new Promise(function (resolve, reject) { var request = { key: key, arg: arg, resolve: resolve, reject: reject, next: null }; if (back) { back = back.next = request; } else { front = back = request; resume(key, arg); } }); } function resume(key, arg) { try { var result = gen[key](arg); var value = result.value; var wrappedAwait = value instanceof _AwaitValue; Promise.resolve(wrappedAwait ? value.wrapped : value).then(function (arg) { if (wrappedAwait) { resume(key === "return" ? "return" : "next", arg); return; } settle(result.done ? "return" : "normal", arg); }, function (err) { resume("throw", err); }); } catch (err) { settle("throw", err); } } function settle(type, value) { switch (type) { case "return": front.resolve({ value: value, done: true }); break; case "throw": front.reject(value); break; default: front.resolve({ value: value, done: false }); break; } front = front.next; if (front) { resume(front.key, front.arg); } else { back = null; } } this._invoke = send; if (typeof gen.return !== "function") { this.return = undefined; } }
if (typeof Symbol === "function" && Symbol.asyncIterator) { _AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; }; }
_AsyncGenerator.prototype.next = function (arg) { return this._invoke("next", arg); };
_AsyncGenerator.prototype.throw = function (arg) { return this._invoke("throw", arg); };
_AsyncGenerator.prototype.return = function (arg) { return this._invoke("return", arg); };
function _AwaitValue(value) { this.wrapped = value; }
function _asyncIterator(iterable) { var method; if (typeof Symbol !== "undefined") { if (Symbol.asyncIterator) { method = iterable[Symbol.asyncIterator]; if (method != null) return method.call(iterable); } if (Symbol.iterator) { method = iterable[Symbol.iterator]; if (method != null) return method.call(iterable); } } throw new TypeError("Object is not async iterable"); }
const {

@@ -189,3 +207,3 @@ map

*
* @param {Array<Block>} blocks
* @param {AsyncIterator<Block>} blocks
* @param {Object} [options] - Options is an object with the following properties

@@ -224,6 +242,6 @@ * @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation

*
* @param {Array<CID>} cids
* @param {AsyncIterator<CID>} cids
* @param {Object} [options] - Options is an object with the following properties
* @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation
* @returns {Iterator<Block>}
* @returns {AsyncIterator<Block>}
*/

@@ -261,3 +279,47 @@

}
/**
* Delete multiple blocks from the blockstore.
*
* @param {AsyncIterator<CID>} cids
* @param {Object} [options] - Options is an object with the following properties
* @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation
* @returns {Promise}
*/
deleteMany(cids, options) {
const repo = this._repo;
return this._repo.blocks.deleteMany(_wrapAsyncGenerator(function* () {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError;
try {
for (var _iterator = _asyncIterator(cids), _step, _value; _step = yield _awaitAsyncGenerator(_iterator.next()), _iteratorNormalCompletion = _step.done, _value = yield _awaitAsyncGenerator(_step.value), !_iteratorNormalCompletion; _iteratorNormalCompletion = true) {
const cid = _value;
if (!(yield _awaitAsyncGenerator(repo.blocks.has(cid)))) {
throw errcode(new Error('blockstore: block not found'), 'ERR_BLOCK_NOT_FOUND');
}
yield cid;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return != null) {
yield _awaitAsyncGenerator(_iterator.return());
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
})(), options);
}
}

@@ -707,3 +769,3 @@

const iterable = iterables_1_1.value;
yield __await((yield* __asyncDelegator(__asyncValues(iterable))));
yield __await(yield* __asyncDelegator(__asyncValues(iterable)));
}

@@ -809,3 +871,3 @@ } catch (e_1_1) {

if (maybeItr && typeof maybeItr !== 'string' && (maybeItr[Symbol.iterator] || maybeItr[Symbol.asyncIterator])) {
yield __await((yield* __asyncDelegator(__asyncValues(flatten(maybeItr)))));
yield __await(yield* __asyncDelegator(__asyncValues(flatten(maybeItr))));
} else {

@@ -836,3 +898,3 @@ yield yield __await(maybeItr);

const val = iterable_1_1.value;
yield yield __await((yield __await(func(val))));
yield yield __await(yield __await(func(val)));
}

@@ -1293,3 +1355,3 @@ } catch (e_1_1) {

const val = iterable_1_1.value;
yield yield __await((yield __await(val)));
yield yield __await(yield __await(val));
taken++;

@@ -1296,0 +1358,0 @@

2

dist/index.min.js
/*! For license information please see index.min.js.LICENSE.txt */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.IpfsBlockService=e():t.IpfsBlockService=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";const{map:r}=n(2),o=n(4);t.exports=class{constructor(t){this._repo=t,this._bitswap=null}setExchange(t){this._bitswap=t}unsetExchange(){this._bitswap=null}hasExchange(){return null!=this._bitswap}put(t,e){return this.hasExchange()?this._bitswap.put(t,e):this._repo.blocks.put(t,e)}putMany(t,e){return this.hasExchange()?this._bitswap.putMany(t,e):this._repo.blocks.putMany(t,e)}get(t,e){return this.hasExchange()?this._bitswap.get(t,e):this._repo.blocks.get(t,e)}getMany(t,e){if(!Array.isArray(t))throw new Error("first arg must be an array of cids");if(this.hasExchange())return this._bitswap.getMany(t,e);return r(t=>this._repo.blocks.get(t,e))(t)}async delete(t,e){if(!await this._repo.blocks.has(t))throw o(new Error("blockstore: block not found"),"ERR_BLOCK_NOT_FOUND");return this._repo.blocks.delete(t,e)}}},function(t,e,n){"use strict";(function(t){function n(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function r(t){return this instanceof r?(this.v=t,this):new r(t)}function o(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,i=n.apply(t,e||[]),l=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(t){i[t]&&(o[t]=function(e){return new Promise((function(n,r){l.push([t,e,n,r])>1||c(t,e)}))})}function c(t,e){try{(n=i[t](e)).value instanceof r?Promise.resolve(n.value.v).then(a,f):s(l[0][2],n)}catch(o){s(l[0][3],o)}var n}function a(t){c("next",t)}function f(t){c("throw",t)}function s(t,e){t(e),l.shift(),l.length&&c(l[0][0],l[0][1])}}function i(t){var e,n;return e={},o("next"),o("throw",(function(t){throw t})),o("return"),e[Symbol.iterator]=function(){return this},e;function o(o,i){e[o]=t[o]?function(e){return(n=!n)?{value:r(t[o](e)),done:"return"===o}:i?i(e):e}:i}}function l(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=n(t),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}}function u(t){if("function"==typeof t.next)return t;if("function"==typeof t[Symbol.iterator])return t[Symbol.iterator]();if("function"==typeof t[Symbol.asyncIterator])return t[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function c(){let t,e;return{promise:new Promise((n,r)=>{e=n,t=r}),reject:t,resolve:e}}function a(t,e){const n=u(e),r=[],o=[];let i=!1,l=!1;async function a(){if(!l&&!(i||r.length>=t)){i=!0;try{const{done:t,value:e}=await n.next();t?l=!0:r.push({value:e})}catch(e){l=!0,r.push({error:e})}!function(){for(;o.length>0&&r.length>0;){const t=o.shift(),{error:e,value:n}=r.shift();e?t.reject(e):t.resolve({done:!1,value:n})}for(;o.length>0&&l;){const{resolve:t}=o.shift();t({done:!0,value:void 0})}}(),i=!1,a()}}const f={next:async function(){if(r.length>0){const{error:t,value:e}=r.shift();if(t)throw t;return a(),{done:!1,value:e}}if(l)return{done:!0,value:void 0};const t=c();return o.push(t),a(),t.promise},[Symbol.asyncIterator]:()=>f};return f}function f(t,e){return void 0===e?e=>f(t,e):e[Symbol.asyncIterator]?a(t,e):function*(t,e){const n=[];let r;try{for(const r of e)n.push(r),n.length<=t||(yield n.shift())}catch(o){r=o}for(const i of n)yield i;if(r)throw r}(t,e)}function s(t,e){return o(this,arguments,(function*(){var n,o;try{for(var i,u=l(e);!(i=yield r(u.next())).done;){const e=i.value;(yield r(t(e)))&&(yield yield r(e))}}catch(c){n={error:c}}finally{try{i&&!i.done&&(o=u.return)&&(yield r(o.call(u)))}finally{if(n)throw n.error}}}))}function y(t,e){return void 0===e?e=>s(t,e):s(t,e)}function d(t){return o(this,arguments,(function*(){var e,n;try{for(var o,u=l(t);!(o=yield r(u.next())).done;){const t=o.value;t&&"string"!=typeof t&&(t[Symbol.iterator]||t[Symbol.asyncIterator])?yield r(yield*i(l(d(t)))):yield yield r(t)}}catch(c){e={error:c}}finally{try{o&&!o.done&&(n=u.return)&&(yield r(n.call(u)))}finally{if(e)throw e.error}}}))}function h(t,e){return o(this,arguments,(function*(){var n,o;try{for(var i,u=l(e);!(i=yield r(u.next())).done;){const e=i.value;yield yield r(yield r(t(e)))}}catch(c){n={error:c}}finally{try{i&&!i.done&&(o=u.return)&&(yield r(o.call(u)))}finally{if(n)throw n.error}}}))}function v(t,e){return void 0===e?e=>h(t,e):h(t,e)}async function p(t){return new Promise(e=>{t.once("readable",()=>{e()})})}function m(t,...e){let n=t();for(const r of e)n=r(n);return n}function w(t,e,n){return void 0===e?(e,n)=>w(t,e,n):void 0===n?n=>w(t,e,n):function(t,e,n){return o(this,arguments,(function*(){let i=null;const c=u(m(()=>n,f(1),(function(t){return o(this,arguments,(function*(){var e,n;try{for(var o,u=l(t);!(o=yield r(u.next())).done;){const t=o.value;if(i)return yield r(void 0);yield yield r(t)}}catch(c){e={error:c}}finally{try{o&&!o.done&&(n=u.return)&&(yield r(n.call(u)))}finally{if(e)throw e.error}}}))}),v(t=>({value:e(t)})),f(t)));for(;;){const{value:t,done:e}=yield r(c.next());if(e)break;try{const e=yield r(t.value);i||(yield yield r(e))}catch(a){i=a}}if(i)throw i}))}(t,e,n)}function b(t,e){return o(this,arguments,(function*(){var n,o;try{for(var i,u=l(e);!(i=yield r(u.next())).done;){const e=i.value;yield r(t(e)),yield yield r(e)}}catch(c){n={error:c}}finally{try{i&&!i.done&&(o=u.return)&&(yield r(o.call(u)))}finally{if(n)throw n.error}}}))}function g(t,e){let n=t[0]+e[0],r=t[1]+e[1];if(r>=1e9){const t=r%1e9;n+=(r-t)/1e9,r=t}return[n,r]}async function x(t,e){var n,r;let o=null,i=null,u=null;const c=t=>{o=t,i&&i(t)},a=()=>{u&&u()};t.once("error",c);try{for(var f,s=l(e);!(f=await s.next()).done;){const e=f.value;if(!1===t.write(e)&&await new Promise((e,n)=>{if(o)return n(o);t.once("drain",a),u=e,i=n}),o)break}}catch(y){n={error:y}}finally{try{f&&!f.done&&(r=s.return)&&await r.call(s)}finally{if(n)throw n.error}}if(t.removeListener("error",c),t.removeListener("drain",a),o)throw o}Object.defineProperty(e,"__esModule",{value:!0}),e.batch=function t(e,n){if(void 0===n)return n=>t(e,n);if(n[Symbol.asyncIterator])return function(t,e){return o(this,arguments,(function*(){var n,o;let i=[];try{for(var u,c=l(e);!(u=yield r(c.next())).done;){const e=u.value;i.push(e),i.length===t&&(yield yield r(i),i=[])}}catch(a){n={error:a}}finally{try{u&&!u.done&&(o=c.return)&&(yield r(o.call(c)))}finally{if(n)throw n.error}}i.length>0&&(yield yield r(i))}))}(e,n);return function*(t,e){let n=[];for(const r of e)n.push(r),n.length===t&&(yield n,n=[]);n.length>0&&(yield n)}(e,n)},e.buffer=f,e.collect=function(t){if(t[Symbol.asyncIterator])return async function(t){var e,n;const r=[];try{for(var o,i=l(t);!(o=await i.next()).done;){const t=o.value;r.push(t)}}catch(u){e={error:u}}finally{try{o&&!o.done&&(n=i.return)&&await n.call(i)}finally{if(e)throw e.error}}return r}(t);return Array.from(t)},e.concat=function(...t){return t.find(t=>void 0!==t[Symbol.asyncIterator])?function(t){return o(this,arguments,(function*(){var e,n;try{for(var o,u=l(t);!(o=yield r(u.next())).done;){const t=o.value;yield r(yield*i(l(t)))}}catch(c){e={error:c}}finally{try{o&&!o.done&&(n=u.return)&&(yield r(n.call(u)))}finally{if(e)throw e.error}}}))}(t):function*(t){for(const e of t)yield*e}(t)},e.consume=function(t){if(t[Symbol.asyncIterator])return async function(t){var e,n;try{for(var r,o=l(t);!(r=await o.next()).done;){r.value}}catch(i){e={error:i}}finally{try{r&&!r.done&&(n=o.return)&&await n.call(o)}finally{if(e)throw e.error}}}(t)},e.filter=y,e.flatMap=function t(e,n){if(void 0===n)return n=>t(e,n);return y(t=>null!=t,d(v(e,n)))},e.flatten=d,e.flatTransform=function t(e,n,r){if(void 0===n)return(n,r)=>r?t(e,n,r):t(e,n);if(void 0===r)return r=>t(e,n,r);return y(t=>null!=t,d(function(t,e,n){const r=u(n),o=[],i=[];let a=!1,f=!1,s=0,y=null;function d(){for(;i.length>0&&o.length>0;){const{resolve:t}=i.shift();t({done:!1,value:o.shift()})}for(;i.length>0&&0===s&&a;){const{resolve:t,reject:e}=i.shift();y?(e(y),y=null):t({done:!0,value:void 0})}}async function h(){if(a)d();else if(!(f||s+o.length>=t)){f=!0,s++;try{const{done:t,value:n}=await r.next();t?(a=!0,s--,d()):async function(t){var n,r;try{const a=await e(t);if(a&&a[Symbol.asyncIterator])try{for(var i,u=l(a);!(i=await u.next()).done;){const t=i.value;o.push(t)}}catch(c){n={error:c}}finally{try{i&&!i.done&&(r=u.return)&&await r.call(u)}finally{if(n)throw n.error}}else o.push(a)}catch(f){a=!0,y=f}s--,d(),h()}(n)}catch(n){a=!0,s--,y=n,d()}f=!1,h()}}const v={next:async function(){if(0===o.length){const t=c();return i.push(t),h(),t.promise}const t=o.shift();return h(),{done:!1,value:t}},[Symbol.asyncIterator]:()=>v};return v}(e,n,r)))},e.fromStream=function(t){if("function"==typeof t[Symbol.asyncIterator])return t;return function(t){return o(this,arguments,(function*(){for(;;){const e=t.read();if(null===e){if(t._readableState.ended)return yield r(void 0);yield r(p(t))}else yield yield r(e)}}))}(t)},e.getIterator=u,e.map=v,e.merge=function(...t){return o(this,arguments,(function*(){const e=new Set(t.map(u));for(;e.size>0;)for(const t of e){const n=yield r(t.next());n.done?e.delete(t):yield yield r(n.value)}}))},e.parallelFlatMap=function t(e,n,r){if(void 0===n)return(n,r)=>r?t(e,n,r):t(e,n);if(void 0===r)return r=>t(e,n,r);return y(t=>null!=t,d(w(e,n,r)))},e.parallelMap=w,e.parallelMerge=function(...t){return o(this,arguments,(function*(){const e=t.map(u),n=new Set,o=new Map;let i=null,l=null,c=null;const a=t=>{i=t,l&&l(t)},f=t=>{c&&c(t)},s=t=>{const e=Promise.resolve(t.next()).then(async({done:r,value:i})=>{r||o.set(t,i),n.delete(e)});n.add(e),e.then(f,a)};for(const t of e)s(t);for(;;){if(0===n.size&&0===o.size)return yield r(void 0);yield r(new Promise((t,e)=>{if(i&&e(i),o.size>0)return t();c=t,l=e}));for(const[t,e]of o)o.delete(t),yield yield r(e),s(t)}}))},e.pipeline=m,e.reduce=function t(e,n,r){if(void 0===n)return(n,r)=>r?t(e,n,r):t(e,n);if(void 0===r)return r=>t(e,n,r);return async function(t,e,n){var r,o;let i=e;try{for(var u,c=l(n);!(u=await c.next()).done;){const e=u.value;i=await t(i,e)}}catch(a){r={error:a}}finally{try{u&&!u.done&&(o=c.return)&&await o.call(c)}finally{if(r)throw r.error}}return i}(e,n,r)},e.take=function t(e,n){if(void 0===n)return n=>t(e,n);if(n[Symbol.asyncIterator])return function(t,e){return o(this,arguments,(function*(){var n,o;let i=0;try{for(var u,c=l(e);!(u=yield r(c.next())).done;){const e=u.value;if(yield yield r(yield r(e)),i++,i>=t)return yield r(void 0)}}catch(a){n={error:a}}finally{try{u&&!u.done&&(o=c.return)&&(yield r(o.call(c)))}finally{if(n)throw n.error}}}))}(e,n);return function*(t,e){let n=0;for(const r of e)if(yield r,n++,n>=t)return}(e,n)},e.tap=function(t,e){if(void 0===e)return e=>b(t,e);return b(t,e)},e.time=function e(n={},i){if(void 0===i)return t=>e(n,t);return void 0!==i[Symbol.asyncIterator]?function(e,n){return o(this,arguments,(function*(){const o=n[Symbol.asyncIterator]();let i=[0,0];for(;;){const n=t.hrtime(),{value:l,done:u}=yield r(o.next()),c=t.hrtime(n);if(i=g(i,c),e.progress&&e.progress(c,i),u)return e.total&&e.total(i),yield r(l);yield yield r(l)}}))}(n,i):function*(e,n){const r=n[Symbol.iterator]();let o=[0,0];for(;;){const n=t.hrtime(),{value:i,done:l}=r.next(),u=t.hrtime(n);if(o=g(o,u),e.progress&&e.progress(u,o),l)return e.total&&e.total(o),i;yield i}}(n,i)},e.transform=function t(e,n,r){if(void 0===n)return(n,r)=>r?t(e,n,r):t(e,n);if(void 0===r)return r=>t(e,n,r);return function(t,e,n){const r=u(n),o=[],i=[];let l=!1,a=!1,f=0,s=null;function y(){for(;i.length>0&&o.length>0;){const{resolve:t}=i.shift();t({done:!1,value:o.shift()})}for(;i.length>0&&0===f&&l;){const{resolve:t,reject:e}=i.shift();s?(e(s),s=null):t({done:!0,value:void 0})}}async function d(){if(l)y();else if(!(a||f+o.length>=t)){a=!0,f++;try{const{done:t,value:n}=await r.next();t?(l=!0,f--,y()):async function(t){try{const n=await e(t);o.push(n)}catch(n){l=!0,s=n}f--,y(),d()}(n)}catch(n){l=!0,f--,s=n,y()}a=!1,d()}}const h={next:async function(){if(0===o.length){const t=c();return i.push(t),d(),t.promise}const t=o.shift();return d(),{done:!1,value:t}},[Symbol.asyncIterator]:()=>h};return h}(e,n,r)},e.writeToStream=function(t,e){if(void 0===e)return e=>x(t,e);return x(t,e)},void 0===Symbol.asyncIterator&&(Symbol.asyncIterator=Symbol.for("asyncIterator"))}).call(this,n(3))},function(t,e,n){"use strict";var r,o,i=t.exports={};function l(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(r===setTimeout)return setTimeout(t,0);if((r===l||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:l}catch(t){r=l}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(t){o=u}}();var a,f=[],s=!1,y=-1;function d(){s&&a&&(s=!1,a.length?f=a.concat(f):y=-1,f.length&&h())}function h(){if(!s){var t=c(d);s=!0;for(var e=f.length;e;){for(a=f,f=[];++y<e;)a&&a[y].run();y=-1,e=f.length}a=null,s=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function v(t,e){this.fun=t,this.array=e}function p(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new v(t,e)),1!==f.length||s||c(h)},v.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r;if(!(t instanceof Error))throw new TypeError("Please pass an Error to err-code");if("object"==typeof e?n=e:null!=e&&(t.code=e),n)for(r in n)t[r]=n[r];return t}}])}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.IpfsBlockService=e():t.IpfsBlockService=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";function r(t){return new i(t)}function o(t){var e,n;function r(e,n){try{var l=t[e](n),u=l.value,c=u instanceof i;Promise.resolve(c?u.wrapped:u).then((function(t){c?r("return"===e?"return":"next",t):o(l.done?"return":"normal",t)}),(function(t){r("throw",t)}))}catch(a){o("throw",a)}}function o(t,o){switch(t){case"return":e.resolve({value:o,done:!0});break;case"throw":e.reject(o);break;default:e.resolve({value:o,done:!1})}(e=e.next)?r(e.key,e.arg):n=null}this._invoke=function(t,o){return new Promise((function(i,l){var u={key:t,arg:o,resolve:i,reject:l,next:null};n?n=n.next=u:(e=n=u,r(t,o))}))},"function"!=typeof t.return&&(this.return=void 0)}function i(t){this.wrapped=t}"function"==typeof Symbol&&Symbol.asyncIterator&&(o.prototype[Symbol.asyncIterator]=function(){return this}),o.prototype.next=function(t){return this._invoke("next",t)},o.prototype.throw=function(t){return this._invoke("throw",t)},o.prototype.return=function(t){return this._invoke("return",t)};const{map:l}=n(2),u=n(4);t.exports=class{constructor(t){this._repo=t,this._bitswap=null}setExchange(t){this._bitswap=t}unsetExchange(){this._bitswap=null}hasExchange(){return null!=this._bitswap}put(t,e){return this.hasExchange()?this._bitswap.put(t,e):this._repo.blocks.put(t,e)}putMany(t,e){return this.hasExchange()?this._bitswap.putMany(t,e):this._repo.blocks.putMany(t,e)}get(t,e){return this.hasExchange()?this._bitswap.get(t,e):this._repo.blocks.get(t,e)}getMany(t,e){if(!Array.isArray(t))throw new Error("first arg must be an array of cids");if(this.hasExchange())return this._bitswap.getMany(t,e);return l(t=>this._repo.blocks.get(t,e))(t)}async delete(t,e){if(!await this._repo.blocks.has(t))throw u(new Error("blockstore: block not found"),"ERR_BLOCK_NOT_FOUND");return this._repo.blocks.delete(t,e)}deleteMany(t,e){const n=this._repo;return this._repo.blocks.deleteMany((i=function*(){var e,o=!0,i=!1;try{for(var l,c,a=function(t){var e;if("undefined"!=typeof Symbol){if(Symbol.asyncIterator&&null!=(e=t[Symbol.asyncIterator]))return e.call(t);if(Symbol.iterator&&null!=(e=t[Symbol.iterator]))return e.call(t)}throw new TypeError("Object is not async iterable")}(t);o=(l=yield r(a.next())).done,c=yield r(l.value),!o;o=!0){const t=c;if(!(yield r(n.blocks.has(t))))throw u(new Error("blockstore: block not found"),"ERR_BLOCK_NOT_FOUND");yield t}}catch(f){i=!0,e=f}finally{try{o||null==a.return||(yield r(a.return()))}finally{if(i)throw e}}},function(){return new o(i.apply(this,arguments))})(),e);var i}}},function(t,e,n){"use strict";(function(t){function n(t){var e="function"==typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function r(t){return this instanceof r?(this.v=t,this):new r(t)}function o(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o,i=n.apply(t,e||[]),l=[];return o={},u("next"),u("throw"),u("return"),o[Symbol.asyncIterator]=function(){return this},o;function u(t){i[t]&&(o[t]=function(e){return new Promise((function(n,r){l.push([t,e,n,r])>1||c(t,e)}))})}function c(t,e){try{(n=i[t](e)).value instanceof r?Promise.resolve(n.value.v).then(a,f):s(l[0][2],n)}catch(o){s(l[0][3],o)}var n}function a(t){c("next",t)}function f(t){c("throw",t)}function s(t,e){t(e),l.shift(),l.length&&c(l[0][0],l[0][1])}}function i(t){var e,n;return e={},o("next"),o("throw",(function(t){throw t})),o("return"),e[Symbol.iterator]=function(){return this},e;function o(o,i){e[o]=t[o]?function(e){return(n=!n)?{value:r(t[o](e)),done:"return"===o}:i?i(e):e}:i}}function l(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=n(t),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(n){e[n]=t[n]&&function(e){return new Promise((function(r,o){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,o,(e=t[n](e)).done,e.value)}))}}}function u(t){if("function"==typeof t.next)return t;if("function"==typeof t[Symbol.iterator])return t[Symbol.iterator]();if("function"==typeof t[Symbol.asyncIterator])return t[Symbol.asyncIterator]();throw new TypeError('"values" does not to conform to any of the iterator or iterable protocols')}function c(){let t,e;return{promise:new Promise((n,r)=>{e=n,t=r}),reject:t,resolve:e}}function a(t,e){const n=u(e),r=[],o=[];let i=!1,l=!1;async function a(){if(!l&&!(i||r.length>=t)){i=!0;try{const{done:t,value:e}=await n.next();t?l=!0:r.push({value:e})}catch(e){l=!0,r.push({error:e})}!function(){for(;o.length>0&&r.length>0;){const t=o.shift(),{error:e,value:n}=r.shift();e?t.reject(e):t.resolve({done:!1,value:n})}for(;o.length>0&&l;){const{resolve:t}=o.shift();t({done:!0,value:void 0})}}(),i=!1,a()}}const f={next:async function(){if(r.length>0){const{error:t,value:e}=r.shift();if(t)throw t;return a(),{done:!1,value:e}}if(l)return{done:!0,value:void 0};const t=c();return o.push(t),a(),t.promise},[Symbol.asyncIterator]:()=>f};return f}function f(t,e){return void 0===e?e=>f(t,e):e[Symbol.asyncIterator]?a(t,e):function*(t,e){const n=[];let r;try{for(const r of e)n.push(r),n.length<=t||(yield n.shift())}catch(o){r=o}for(const i of n)yield i;if(r)throw r}(t,e)}function s(t,e){return o(this,arguments,(function*(){var n,o;try{for(var i,u=l(e);!(i=yield r(u.next())).done;){const e=i.value;(yield r(t(e)))&&(yield yield r(e))}}catch(c){n={error:c}}finally{try{i&&!i.done&&(o=u.return)&&(yield r(o.call(u)))}finally{if(n)throw n.error}}}))}function y(t,e){return void 0===e?e=>s(t,e):s(t,e)}function d(t){return o(this,arguments,(function*(){var e,n;try{for(var o,u=l(t);!(o=yield r(u.next())).done;){const t=o.value;t&&"string"!=typeof t&&(t[Symbol.iterator]||t[Symbol.asyncIterator])?yield r(yield*i(l(d(t)))):yield yield r(t)}}catch(c){e={error:c}}finally{try{o&&!o.done&&(n=u.return)&&(yield r(n.call(u)))}finally{if(e)throw e.error}}}))}function h(t,e){return o(this,arguments,(function*(){var n,o;try{for(var i,u=l(e);!(i=yield r(u.next())).done;){const e=i.value;yield yield r(yield r(t(e)))}}catch(c){n={error:c}}finally{try{i&&!i.done&&(o=u.return)&&(yield r(o.call(u)))}finally{if(n)throw n.error}}}))}function v(t,e){return void 0===e?e=>h(t,e):h(t,e)}async function p(t){return new Promise(e=>{t.once("readable",()=>{e()})})}function m(t,...e){let n=t();for(const r of e)n=r(n);return n}function w(t,e,n){return void 0===e?(e,n)=>w(t,e,n):void 0===n?n=>w(t,e,n):function(t,e,n){return o(this,arguments,(function*(){let i=null;const c=u(m(()=>n,f(1),(function(t){return o(this,arguments,(function*(){var e,n;try{for(var o,u=l(t);!(o=yield r(u.next())).done;){const t=o.value;if(i)return yield r(void 0);yield yield r(t)}}catch(c){e={error:c}}finally{try{o&&!o.done&&(n=u.return)&&(yield r(n.call(u)))}finally{if(e)throw e.error}}}))}),v(t=>({value:e(t)})),f(t)));for(;;){const{value:t,done:e}=yield r(c.next());if(e)break;try{const e=yield r(t.value);i||(yield yield r(e))}catch(a){i=a}}if(i)throw i}))}(t,e,n)}function b(t,e){return o(this,arguments,(function*(){var n,o;try{for(var i,u=l(e);!(i=yield r(u.next())).done;){const e=i.value;yield r(t(e)),yield yield r(e)}}catch(c){n={error:c}}finally{try{i&&!i.done&&(o=u.return)&&(yield r(o.call(u)))}finally{if(n)throw n.error}}}))}function g(t,e){let n=t[0]+e[0],r=t[1]+e[1];if(r>=1e9){const t=r%1e9;n+=(r-t)/1e9,r=t}return[n,r]}async function x(t,e){var n,r;let o=null,i=null,u=null;const c=t=>{o=t,i&&i(t)},a=()=>{u&&u()};t.once("error",c);try{for(var f,s=l(e);!(f=await s.next()).done;){const e=f.value;if(!1===t.write(e)&&await new Promise((e,n)=>{if(o)return n(o);t.once("drain",a),u=e,i=n}),o)break}}catch(y){n={error:y}}finally{try{f&&!f.done&&(r=s.return)&&await r.call(s)}finally{if(n)throw n.error}}if(t.removeListener("error",c),t.removeListener("drain",a),o)throw o}Object.defineProperty(e,"__esModule",{value:!0}),e.batch=function t(e,n){if(void 0===n)return n=>t(e,n);if(n[Symbol.asyncIterator])return function(t,e){return o(this,arguments,(function*(){var n,o;let i=[];try{for(var u,c=l(e);!(u=yield r(c.next())).done;){const e=u.value;i.push(e),i.length===t&&(yield yield r(i),i=[])}}catch(a){n={error:a}}finally{try{u&&!u.done&&(o=c.return)&&(yield r(o.call(c)))}finally{if(n)throw n.error}}i.length>0&&(yield yield r(i))}))}(e,n);return function*(t,e){let n=[];for(const r of e)n.push(r),n.length===t&&(yield n,n=[]);n.length>0&&(yield n)}(e,n)},e.buffer=f,e.collect=function(t){if(t[Symbol.asyncIterator])return async function(t){var e,n;const r=[];try{for(var o,i=l(t);!(o=await i.next()).done;){const t=o.value;r.push(t)}}catch(u){e={error:u}}finally{try{o&&!o.done&&(n=i.return)&&await n.call(i)}finally{if(e)throw e.error}}return r}(t);return Array.from(t)},e.concat=function(...t){return t.find(t=>void 0!==t[Symbol.asyncIterator])?function(t){return o(this,arguments,(function*(){var e,n;try{for(var o,u=l(t);!(o=yield r(u.next())).done;){const t=o.value;yield r(yield*i(l(t)))}}catch(c){e={error:c}}finally{try{o&&!o.done&&(n=u.return)&&(yield r(n.call(u)))}finally{if(e)throw e.error}}}))}(t):function*(t){for(const e of t)yield*e}(t)},e.consume=function(t){if(t[Symbol.asyncIterator])return async function(t){var e,n;try{for(var r,o=l(t);!(r=await o.next()).done;){r.value}}catch(i){e={error:i}}finally{try{r&&!r.done&&(n=o.return)&&await n.call(o)}finally{if(e)throw e.error}}}(t)},e.filter=y,e.flatMap=function t(e,n){if(void 0===n)return n=>t(e,n);return y(t=>null!=t,d(v(e,n)))},e.flatten=d,e.flatTransform=function t(e,n,r){if(void 0===n)return(n,r)=>r?t(e,n,r):t(e,n);if(void 0===r)return r=>t(e,n,r);return y(t=>null!=t,d(function(t,e,n){const r=u(n),o=[],i=[];let a=!1,f=!1,s=0,y=null;function d(){for(;i.length>0&&o.length>0;){const{resolve:t}=i.shift();t({done:!1,value:o.shift()})}for(;i.length>0&&0===s&&a;){const{resolve:t,reject:e}=i.shift();y?(e(y),y=null):t({done:!0,value:void 0})}}async function h(){if(a)d();else if(!(f||s+o.length>=t)){f=!0,s++;try{const{done:t,value:n}=await r.next();t?(a=!0,s--,d()):async function(t){var n,r;try{const a=await e(t);if(a&&a[Symbol.asyncIterator])try{for(var i,u=l(a);!(i=await u.next()).done;){const t=i.value;o.push(t)}}catch(c){n={error:c}}finally{try{i&&!i.done&&(r=u.return)&&await r.call(u)}finally{if(n)throw n.error}}else o.push(a)}catch(f){a=!0,y=f}s--,d(),h()}(n)}catch(n){a=!0,s--,y=n,d()}f=!1,h()}}const v={next:async function(){if(0===o.length){const t=c();return i.push(t),h(),t.promise}const t=o.shift();return h(),{done:!1,value:t}},[Symbol.asyncIterator]:()=>v};return v}(e,n,r)))},e.fromStream=function(t){if("function"==typeof t[Symbol.asyncIterator])return t;return function(t){return o(this,arguments,(function*(){for(;;){const e=t.read();if(null===e){if(t._readableState.ended)return yield r(void 0);yield r(p(t))}else yield yield r(e)}}))}(t)},e.getIterator=u,e.map=v,e.merge=function(...t){return o(this,arguments,(function*(){const e=new Set(t.map(u));for(;e.size>0;)for(const t of e){const n=yield r(t.next());n.done?e.delete(t):yield yield r(n.value)}}))},e.parallelFlatMap=function t(e,n,r){if(void 0===n)return(n,r)=>r?t(e,n,r):t(e,n);if(void 0===r)return r=>t(e,n,r);return y(t=>null!=t,d(w(e,n,r)))},e.parallelMap=w,e.parallelMerge=function(...t){return o(this,arguments,(function*(){const e=t.map(u),n=new Set,o=new Map;let i=null,l=null,c=null;const a=t=>{i=t,l&&l(t)},f=t=>{c&&c(t)},s=t=>{const e=Promise.resolve(t.next()).then(async({done:r,value:i})=>{r||o.set(t,i),n.delete(e)});n.add(e),e.then(f,a)};for(const t of e)s(t);for(;;){if(0===n.size&&0===o.size)return yield r(void 0);yield r(new Promise((t,e)=>{if(i&&e(i),o.size>0)return t();c=t,l=e}));for(const[t,e]of o)o.delete(t),yield yield r(e),s(t)}}))},e.pipeline=m,e.reduce=function t(e,n,r){if(void 0===n)return(n,r)=>r?t(e,n,r):t(e,n);if(void 0===r)return r=>t(e,n,r);return async function(t,e,n){var r,o;let i=e;try{for(var u,c=l(n);!(u=await c.next()).done;){const e=u.value;i=await t(i,e)}}catch(a){r={error:a}}finally{try{u&&!u.done&&(o=c.return)&&await o.call(c)}finally{if(r)throw r.error}}return i}(e,n,r)},e.take=function t(e,n){if(void 0===n)return n=>t(e,n);if(n[Symbol.asyncIterator])return function(t,e){return o(this,arguments,(function*(){var n,o;let i=0;try{for(var u,c=l(e);!(u=yield r(c.next())).done;){const e=u.value;if(yield yield r(yield r(e)),i++,i>=t)return yield r(void 0)}}catch(a){n={error:a}}finally{try{u&&!u.done&&(o=c.return)&&(yield r(o.call(c)))}finally{if(n)throw n.error}}}))}(e,n);return function*(t,e){let n=0;for(const r of e)if(yield r,n++,n>=t)return}(e,n)},e.tap=function(t,e){if(void 0===e)return e=>b(t,e);return b(t,e)},e.time=function e(n={},i){if(void 0===i)return t=>e(n,t);return void 0!==i[Symbol.asyncIterator]?function(e,n){return o(this,arguments,(function*(){const o=n[Symbol.asyncIterator]();let i=[0,0];for(;;){const n=t.hrtime(),{value:l,done:u}=yield r(o.next()),c=t.hrtime(n);if(i=g(i,c),e.progress&&e.progress(c,i),u)return e.total&&e.total(i),yield r(l);yield yield r(l)}}))}(n,i):function*(e,n){const r=n[Symbol.iterator]();let o=[0,0];for(;;){const n=t.hrtime(),{value:i,done:l}=r.next(),u=t.hrtime(n);if(o=g(o,u),e.progress&&e.progress(u,o),l)return e.total&&e.total(o),i;yield i}}(n,i)},e.transform=function t(e,n,r){if(void 0===n)return(n,r)=>r?t(e,n,r):t(e,n);if(void 0===r)return r=>t(e,n,r);return function(t,e,n){const r=u(n),o=[],i=[];let l=!1,a=!1,f=0,s=null;function y(){for(;i.length>0&&o.length>0;){const{resolve:t}=i.shift();t({done:!1,value:o.shift()})}for(;i.length>0&&0===f&&l;){const{resolve:t,reject:e}=i.shift();s?(e(s),s=null):t({done:!0,value:void 0})}}async function d(){if(l)y();else if(!(a||f+o.length>=t)){a=!0,f++;try{const{done:t,value:n}=await r.next();t?(l=!0,f--,y()):async function(t){try{const n=await e(t);o.push(n)}catch(n){l=!0,s=n}f--,y(),d()}(n)}catch(n){l=!0,f--,s=n,y()}a=!1,d()}}const h={next:async function(){if(0===o.length){const t=c();return i.push(t),d(),t.promise}const t=o.shift();return d(),{done:!1,value:t}},[Symbol.asyncIterator]:()=>h};return h}(e,n,r)},e.writeToStream=function(t,e){if(void 0===e)return e=>x(t,e);return x(t,e)},void 0===Symbol.asyncIterator&&(Symbol.asyncIterator=Symbol.for("asyncIterator"))}).call(this,n(3))},function(t,e,n){"use strict";var r,o,i=t.exports={};function l(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(r===setTimeout)return setTimeout(t,0);if((r===l||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:l}catch(t){r=l}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(t){o=u}}();var a,f=[],s=!1,y=-1;function d(){s&&a&&(s=!1,a.length?f=a.concat(f):y=-1,f.length&&h())}function h(){if(!s){var t=c(d);s=!0;for(var e=f.length;e;){for(a=f,f=[];++y<e;)a&&a[y].run();y=-1,e=f.length}a=null,s=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===u||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function v(t,e){this.fun=t,this.array=e}function p(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new v(t,e)),1!==f.length||s||c(h)},v.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(t,e,n){"use strict";t.exports=function(t,e,n){var r;if(!(t instanceof Error))throw new TypeError("Please pass an Error to err-code");if("object"==typeof e?n=e:null!=e&&(t.code=e),n)for(r in n)t[r]=n[r];return t}}])}));
//# sourceMappingURL=index.min.js.map
{
"name": "ipfs-block-service",
"version": "0.17.0",
"version": "0.17.1",
"description": "JavaScript Implementation of BlockService",

@@ -40,4 +40,4 @@ "leadMaintainer": "Volker Mische <volker.mische@gmail.com>",

"fs-extra": "^9.0.0",
"ipfs-block": "~0.8.1",
"ipfs-repo": "^1.0.1",
"ipfs-repo": "^2.1.0",
"ipld-block": "^0.9.1",
"lodash": "^4.17.11",

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

"Dirk McCormick <dirkmdev@gmail.com>",
"Hector Sanjuan <code@hector.link>",
"Pedro Santos <pedro.santos@moxy.studio>",

@@ -65,0 +66,0 @@ "Richard Littauer <richard.littauer@gmail.com>",

@@ -34,12 +34,15 @@ # IPFS Block Service

- [Install](#install)
- [npm](#npm)
- [Usage](#usage)
- [Node.js](#nodejs)
- [Example](#example)
- [Browser: Browserify, Webpack, other bundlers](#browser-browserify-webpack-other-bundlers)
- [Browser: `<script>` Tag](#browser-script-tag)
- [API](#api)
- [Contribute](#contribute)
- [License](#license)
- [IPFS Block Service](#ipfs-block-service)
- [Lead Maintainer](#lead-maintainer)
- [Table of Contents](#table-of-contents)
- [Install](#install)
- [npm](#npm)
- [Usage](#usage)
- [Node.js](#nodejs)
- [Example](#example)
- [Browser: Browserify, Webpack, other bundlers](#browser-browserify-webpack-other-bundlers)
- [Browser: `<script>` Tag](#browser-script-tag)
- [API](#api)
- [Contribute](#contribute)
- [License](#license)

@@ -67,3 +70,3 @@ ## Install

const BlockService = require('ipfs-block-service')
const Block = require('ipfs-block')
const Block = require('ipld-block')
const multihashing = require('multihashing-async')

@@ -70,0 +73,0 @@ const IPFSRepo = require('ipfs-repo') // storage repo

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

*
* @param {Array<Block>} blocks
* @param {AsyncIterator<Block>} blocks
* @param {Object} [options] - Options is an object with the following properties

@@ -106,6 +106,6 @@ * @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation

*
* @param {Array<CID>} cids
* @param {AsyncIterator<CID>} cids
* @param {Object} [options] - Options is an object with the following properties
* @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation
* @returns {Iterator<Block>}
* @returns {AsyncIterator<Block>}
*/

@@ -140,4 +140,26 @@ getMany (cids, options) {

}
/**
* Delete multiple blocks from the blockstore.
*
* @param {AsyncIterator<CID>} cids
* @param {Object} [options] - Options is an object with the following properties
* @param {AbortSignal} [options.signal] - A signal that can be used to abort any long-lived operations that are started as a result of this operation
* @returns {Promise}
*/
deleteMany (cids, options) {
const repo = this._repo
return this._repo.blocks.deleteMany((async function * () {
for await (const cid of cids) {
if (!await repo.blocks.has(cid)) {
throw errcode(new Error('blockstore: block not found'), 'ERR_BLOCK_NOT_FOUND')
}
yield cid
}
}()), options)
}
}
module.exports = BlockService

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc