IPFSWebNode class

A minimal IPFS node for web browsers.

This provides offline IPFS functionality without P2P networking:

  • Add content and get CID
  • Retrieve content by CID
  • Local storage via IndexedDB

For full P2P functionality, run on native platforms (iOS, Android, desktop) or use a WebRTC/WebSocket relay supported by the router.

Constructors

IPFSWebNode({IPFSConfig? config, List<String> bootstrapPeers = const [], RouterInterface? router, BitswapHandler? bitswap})
Creates a new web IPFS node.

Properties

addresses → List<String>
The node's listen multiaddresses, empty when not started.
no setter
bitswap → BitswapHandler
Access to Bitswap handler.
no setter
bootstrapPeers → List<String>
List of bootstrap peers (WebSocket URLs) to connect to on startup.
final
hashCode → int
The hash code for this object.
no setterinherited
isRunning → bool
Whether the node is running.
no setter
peerID → String
The node's peer ID.
no setter
pubsub → PubSubClient
Access to PubSub client.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
securityManager → SecurityManagerWeb
Access to security manager.
no setter

Methods

add(Uint8List data, {int cidVersion = 0, bool rawLeaves = false}) → Future<CID>
Adds data and returns its CID.
addFile(dynamic file) → Future<CID>
Adds a file to IPFS using chunked streaming.
addStream(Stream<List<int>> stream, {int cidVersion = 0, bool rawLeaves = false}) → Future<CID>
Adds data from a stream and returns the root CID.
cat(CID cid) → Future<Uint8List?>
Gets data by CID object.
connectToPeer(String multiaddr) → Future<void>
Connects to a peer given a full multiaddr (/ip4/.../p2p/<peerId>).
get(String cidString) → Future<Uint8List?>
Gets data by CID string.
listPins() → Future<List<String>>
Lists all pinned CIDs.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pin(CID cid) → Future<void>
Pins a CID (marks it as persistent).
publishIPNS(String cid, {required String keyName}) → Future<void>
Publishes an IPNS record.
resolveIPNS(String name) → Future<String?>
Resolves an IPNS name.
start() → Future<void>
Starts the web node.
stop() → Future<void>
Stops the web node.
toString() → String
A string representation of this object.
inherited
unpin(CID cid) → Future<void>
Unpins a CID.

Operators

operator ==(Object other) → bool
The equality operator.
inherited