IPFS class
Main entry point for the IPFS (InterPlanetary File System) implementation.
This class provides a high-level interface for interacting with IPFS, including content storage, retrieval, pinning, and networking operations.
Example Usage:
final ipfs = IPFS();
// Add content
final block = await Block.fromData(utf8.encode('Hello IPFS'));
await ipfs.store(block);
// Retrieve content
final retrieved = await ipfs.retrieve(block.cid.toString());
For more advanced usage, consider using IPFSNode directly which provides full control over configuration, networking, and services.
See also:
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onNewContent
→ Stream<
String> -
Stream of new content CIDs added to the node.
no setter
- peerID → String
-
Gets the peer ID of the IPFS node.
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.
-
addFile(
Uint8List data) → Future< String> - Adds a file to the IPFS network from its raw data.
-
exportCAR(
String cid) → Future< Uint8List> - Exports a CAR file for the given CID.
-
findProviders(
String cid) → Future< List< String> > - Finds providers for a CID.
-
get(
String cid, {String path = ''}) → Future< Uint8List?> - Gets the content of a file or directory from IPFS.
-
importCAR(
Uint8List carFile) → Future< void> - Imports a CAR file.
-
ls(
String cid) → Future< List< Link> > - Lists the contents of a directory in IPFS.
-
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> - Publishes a message to a PubSub topic.
-
publishIPNS(
String cid, {required String keyName}) → Future< void> - Publishes an IPNS record.
-
requestBlock(
String cid, String peerID) → Future< void> - Requests a block from the network using Bitswap.
-
resolveDNSLink(
String domainName) → Future< String> - Resolves a DNSLink to its corresponding CID.
-
resolveIPNS(
String ipnsName) → Future< String> - Resolves an IPNS name to its corresponding CID.
-
start(
) → Future< void> - Starts the IPFS node.
-
stats(
) → Future< NodeStats> - Gets the node's statistics.
-
stop(
) → Future< void> - Stops the IPFS node.
-
subscribe(
String topic) → Future< void> - Subscribes to a PubSub topic.
-
toString(
) → String -
A string representation of this object.
inherited
-
unpin(
String cid) → Future< void> - Unpins a CID.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
create(
{IPFSConfig? config}) → Future< IPFS> - Creates a new IPFS node.