🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

ipfs-bitswap

Package Overview
Dependencies
Maintainers
6
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-bitswap - npm Package Compare versions

Comparing version

to
17.0.1

5

dist/src/bitswap.d.ts

@@ -9,3 +9,3 @@ import { WantManager } from './want-manager/index.js';

import type { Libp2p } from '@libp2p/interface-libp2p';
import type { Blockstore, Options, Pair } from 'interface-blockstore';
import type { Blockstore, Pair } from 'interface-blockstore';
import type { PeerId } from '@libp2p/interface-peer-id';

@@ -15,2 +15,3 @@ import type { BitswapMessage } from './message/index.js';

import type { ProgressOptions } from 'progress-events';
import type { AwaitIterable } from 'interface-store';
/**

@@ -91,3 +92,3 @@ * JavaScript implementation of the Bitswap 'data exchange' protocol

*/
putMany(source: Iterable<Pair> | AsyncIterable<Pair>, options?: Options): AsyncGenerator<Pair>;
putMany(source: Iterable<Pair> | AsyncIterable<Pair>, options?: AbortOptions): AwaitIterable<CID>;
/**

@@ -94,0 +95,0 @@ * Sends notifications about the arrival of a block

6

dist/src/bitswap.js

@@ -9,2 +9,3 @@ import { WantManager } from './want-manager/index.js';

import { CID } from 'multiformats/cid';
import forEach from 'it-foreach';
const hashLoader = {

@@ -253,6 +254,5 @@ async getHasher() {

async *putMany(source, options) {
for await (const { cid, block } of this.blockstore.putMany(source, options)) {
yield* this.blockstore.putMany(forEach(source, ({ cid, block }) => {
this.notify(cid, block);
yield { cid, block };
}
}), options);
}

@@ -259,0 +259,0 @@ /**

@@ -89,3 +89,3 @@ import * as lp from 'it-length-prefixed';

this._log('incoming new bitswap %s connection from %p', stream.stat.protocol, connection.remotePeer);
await pipe(abortableSource(stream.source, controller.signal), lp.decode(), async (source) => {
await pipe(abortableSource(stream.source, controller.signal), (source) => lp.decode(source), async (source) => {
for await (const data of source) {

@@ -195,3 +195,3 @@ try {

}
await pipe([serialized], lp.encode(), stream);
await pipe([serialized], (source) => lp.encode(source), stream);
}

@@ -198,0 +198,0 @@ catch (err) {

{
"name": "ipfs-bitswap",
"version": "17.0.0",
"version": "17.0.1",
"description": "JavaScript implementation of the Bitswap data exchange protocol used by IPFS",

@@ -175,3 +175,3 @@ "license": "Apache-2.0 OR MIT",

"@libp2p/tracked-map": "^3.0.0",
"@multiformats/multiaddr": "^11.0.0",
"@multiformats/multiaddr": "^12.1.0",
"@vascosantos/moving-average": "^1.1.0",

@@ -181,7 +181,10 @@ "abortable-iterator": "^4.0.2",

"blockstore-core": "^4.0.0",
"events": "^3.3.0",
"interface-blockstore": "^5.0.0",
"it-length-prefixed": "^8.0.2",
"it-map": "^2.0.1",
"it-pipe": "^2.0.4",
"it-take": "^2.0.1",
"interface-store": "^5.1.0",
"it-foreach": "^2.0.2",
"it-length-prefixed": "^9.0.0",
"it-map": "^3.0.2",
"it-pipe": "^3.0.1",
"it-take": "^3.0.1",
"just-debounce-it": "^3.0.1",

@@ -199,3 +202,3 @@ "multiformats": "^11.0.0",

"@chainsafe/libp2p-noise": "^11.0.0",
"@libp2p/kad-dht": "^7.0.0",
"@libp2p/kad-dht": "^8.0.6",
"@libp2p/mplex": "^7.0.0",

@@ -212,5 +215,5 @@ "@libp2p/peer-id": "^2.0.0",

"iso-random-stream": "^2.0.0",
"it-all": "^2.0.0",
"it-drain": "^2.0.0",
"libp2p": "^0.42.0",
"it-all": "^3.0.1",
"it-drain": "^3.0.1",
"libp2p": "^0.43.3",
"lodash.difference": "^4.5.0",

@@ -217,0 +220,0 @@ "lodash.flatten": "^4.4.0",

@@ -9,5 +9,6 @@ import { WantManager } from './want-manager/index.js'

import { CID } from 'multiformats/cid'
import forEach from 'it-foreach'
import type { BitswapOptions, Bitswap, MultihashHasherLoader, WantListEntry, BitswapWantProgressEvents, BitswapNotifyProgressEvents } from './index.js'
import type { Libp2p } from '@libp2p/interface-libp2p'
import type { Blockstore, Options, Pair } from 'interface-blockstore'
import type { Blockstore, Pair } from 'interface-blockstore'
import type { Logger } from '@libp2p/logger'

@@ -18,2 +19,3 @@ import type { PeerId } from '@libp2p/interface-peer-id'

import type { ProgressOptions } from 'progress-events'
import type { AwaitIterable } from 'interface-store'

@@ -323,8 +325,6 @@ const hashLoader: MultihashHasherLoader = {

*/
async * putMany (source: Iterable<Pair> | AsyncIterable<Pair>, options?: Options): AsyncGenerator<Pair> {
for await (const { cid, block } of this.blockstore.putMany(source, options)) {
async * putMany (source: Iterable<Pair> | AsyncIterable<Pair>, options?: AbortOptions): AwaitIterable<CID> {
yield * this.blockstore.putMany(forEach(source, ({ cid, block }) => {
this.notify(cid, block)
yield { cid, block }
}
}), options)
}

@@ -331,0 +331,0 @@

@@ -160,3 +160,3 @@ import * as lp from 'it-length-prefixed'

abortableSource(stream.source, controller.signal),
lp.decode(),
(source) => lp.decode(source),
async (source) => {

@@ -291,3 +291,3 @@ for await (const data of source) {

[serialized],
lp.encode(),
(source) => lp.encode(source),
stream

@@ -294,0 +294,0 @@ )

Sorry, the diff of this file is too big to display

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