![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
ipfs-bitswap
Advanced tools
Node.js implementation of the Bitswap 'data exchange' protocol used by IPFS
> npm install ipfs-bitswap --save
const Bitswap = require('ipfs-bitswap')
The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.
const Bitswap = require('ipfs-bitswap')
Loading this module through a script tag will make the IpfsBitswap
object available in the global namespace.
<script src="https://unpkg.com/ipfs-bitswap/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/ipfs-bitswap/dist/index.js"></script>
For the documentation see API.md.
new Bitswap(libp2p, blockstore)
libp2p: Libp2p
, instance of the local network stack.blockstore: Blockstore
, instance of the local database (IpfsRepo.blockstore
)Create a new instance.
getStream(cid)
cid: CID|Array
Returns a source pull-stream
. Values emitted are the received blocks.
Example:
// Single block
pull(
bitswap.getStream(cid),
pull.collect((err, blocks) => {
// blocks === [block]
})
)
// Many blocks
pull(
bitswap.getStream([cid1, cid2, cid3]),
pull.collect((err, blocks) => {
// blocks === [block1, block2, block3]
})
)
Note: This is safe guarded so that the network is not asked for blocks that are in the local
datastore
.
unwant(cids)
cids: CID|[]CID
Cancel previously requested cids, forcefully. That means they are removed from the
wantlist independent of how many other resources requested these cids. Callbacks
attached to getBlock
are errored with Error('manual unwant: cid)
.
cancelWants(cids)
cid: CID|[]CID
Cancel previously requested cids.
putStream()
Returns a duplex pull-stream
that emits an object {cid: CID}
for every written block when it was stored.
Objects passed into here should be of the form {data: Buffer, cid: CID}
put(blockAndCid, callback)
blockAndCid: {data: Buffer, cid: CID}
callback: Function
Announce that the current node now has the block containing data
. This will store it
in the local database and attempt to serve it to all peers that are known
to have requested it. The callback is called when we are sure that the block
is stored.
wantlistForPeer(peerId)
peerId: PeerId
Get the wantlist for a given peer.
stat()
Get stats about about the current state of the bitswap instance.
» tree src
src
├── components
│ ├── decision
│ │ ├── engine.js
│ │ ├── index.js
│ │ └── ledger.js
│ ├── network # Handles peerSet and open new conns
│ │ └── index.js
│ └── want-manager # Keeps track of all blocks the peer wants (not the others which it is connected)
│ ├── index.js
│ └── msg-queue.js # Messages to send queue, one per peer
├── constants.js
├── index.js
└── types
├── message # (Type) message that is put in the wire
│ ├── entry.js
│ ├── index.js
│ └── message.proto.js
└── wantlist # (Type) track wanted blocks
├── entry.js
└── index.js
Feel free to join in. All welcome. Open an issue!
This repository falls under the IPFS Code of Conduct.
FAQs
JavaScript implementation of the Bitswap data exchange protocol used by IPFS
The npm package ipfs-bitswap receives a total of 63 weekly downloads. As such, ipfs-bitswap popularity was classified as not popular.
We found that ipfs-bitswap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.