IPFSNode class
The main IPFS node implementation.
Provides high-level APIs for content addressing, publishing, DHT operations, and peer-to-peer networking.
Constructors
- IPFSNode.fromContainer(ServiceContainer _container)
- Creates an IPFSNode from a pre-configured service container.
Properties
-
addresses
→ List<
String> -
Get the addresses this node is listening on
no setter
-
bandwidthMetrics
→ Stream<
Map< String, dynamic> > -
Broadcast stream of bandwidth metrics
no setter
- bitswap → BitswapHandler
-
Access to the Bitswap handler.
no setter
- blockStore → BlockStore
-
Get the block store
no setter
-
connectedPeers
→ Future<
List< String> > -
Get list of connected peers
no setter
- container → ServiceContainer
-
Returns the service container for dependency injection.
no setter
- datastore → Datastore
-
Access to the underlying datastore.
no setter
- dhtClient → DHTClient
-
Get the DHT client
no setter
- dhtHandler → DHTHandler
-
Access to the DHT handler.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onNewContent
→ Stream<
String> -
Stream of new content CIDs added to this node.
no setter
- peerId → String
-
Get the peer ID of this node
no setter
- peerID → String
-
This node's peer ID.
no setter
-
pinnedCids
→ Future<
List< String> > -
Get list of pinned CIDs
no setter
-
publicKey
→ Future<
String> -
Get the public key of this node (base64 encoded)
no setter
-
pubsubMessages
→ Stream<
PubSubMessage> -
Stream of incoming PubSub messages
no setter
- router → Router
-
Access to the network router.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addDirectory(
Map< String, dynamic> directoryContent) → Future<String> - Adds a directory to IPFS and returns its CID.
-
addFile(
Uint8List data) → Future< String> - Adds a file to IPFS and returns its CID.
-
addFileStream(
Stream< List< dataStream) → Future<int> >String> - Adds file content from a stream (memory-efficient for large files)
-
cat(
String cid) → Future< Uint8List?> - Get content by CID (alias for get method)
-
connectToPeer(
String multiaddr) → Future< void> - Connect to a peer by multiaddr
-
disconnectFromPeer(
String peerIdOrAddr) → Future< void> - Disconnect from a peer
-
exportCAR(
String cid) → Future< Uint8List> - Exports a CAR file for the given CID.
-
findProviders(
String cid) → Future< List< String> > - Finds providers for a given CID.
-
get(
String cid, {String path = ''}) → Future< Uint8List?> - Gets the content of a file or directory from IPFS.
-
getHealthStatus(
) → Future< Map< String, dynamic> > - Returns a health status map for all subsystems.
-
importCAR(
Uint8List carFile) → Future< void> - Imports a CAR (Content Addressable Archive) file.
-
ls(
String cid) → Future< List< Link> > - Lists the contents of an IPFS directory.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pin(
String cid) → Future< void> - Pins a CID to prevent it from being garbage collected.
-
publish(
String topic, String message) → Future< void> - Publish a message
-
publishIPNS(
String cid, {required String keyName}) → Future< void> - Publishes an IPNS record for the given CID.
-
requestBlock(
String cid, Peer peer) → Future< void> - Requests a specific block from a peer via Bitswap.
-
resolveDNSLink(
String domainName) → Future< String> - Resolves a DNSLink to its corresponding CID.
-
resolveIPNS(
String name) → Future< String> - Resolve IPNS name to CID
-
resolvePeerId(
String peerIdStr) → List< String> - Resolve a peer ID to its known addresses (from Routing Table)
-
setGatewayMode(
GatewayMode mode, {String? customUrl}) → void - Sets the mode for retrieving content.
-
start(
) → Future< void> - Starts the IPFS node and all its subsystems.
-
stop(
) → Future< void> - Stops the IPFS node gracefully, releasing all resources.
-
subscribe(
String topic) → Future< void> - Subscribe to a topic
-
toString(
) → String -
A string representation of this object.
inherited
-
unpin(
String cid) → Future< bool> - Unpins a CID from IPFS.
-
unsubscribe(
String topic) → Future< void> - Unsubscribe from a topic
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
create(
IPFSConfig config) → Future< IPFSNode> - Factory method to create and build an IPFS node from configuration.