Last updated:
0 purchases
ipfs http rpc
ipfs_http_rpc #
A full implementation for IPFS HTTP RPC.
Features #
Contains all HTTP RPC commands listed in reference
Experimental commands are also added
All commands have documentation and ease of access.
Standardized responses.
Usage #
import 'package:ipfs_http_rpc/ipfs.dart';
// Use directly from Ipfs() or by getting the singleton instance of `Ipfs`.
Ipfs ipfs = Ipfs();
// `ipfs.url` is set to "http://127.0.0.1:5001/api/v0" by default. It can be
// changed on the factory constructor or by setting it manually.
Ipfs(url: "https://my-ipfs-endpoint/api/v0");
ipfs.url = "https://my-ipfs-endpoint/api/v0";
copied to clipboard
Access all commands with guaranteed responses #
// Successful request
Map<String, dynamic> response = await ipfs.add(path: "/my/local/file.txt", wrapWithDirectory: true);
// response = {
// "StatusCode": "200",
// "StatusMessage": "OK"
// "Name": "file.txt",
// "Hash": "QmRDebtk...",
// "Size": "281",
// }
copied to clipboard
// Unsuccessful request
Map<String, dynamic> response = await ipfs.filestore.ls();
// response = {
// StatusCode: 500,
// StatusMessage: Internal Server Error,
// Message: filestore is not enabled, see https://git.io/vNItf,
// Code: 0,
// Type: error
// }
copied to clipboard
Some commands (like ipfs refs), should technically be callable from ipfs.refs(). However, because this command also contains subcommands (ipfs refs local), it can only be called with ipfs.refs.self() as a way to solve the naming conflict:
// Does not work:
ipfs.refs();
ipfs.refs.local();
// DOES work
ipfs.refs.self();
ipfs.refs.local();
copied to clipboard
This applies to other commands and subcommands (bootstrap, diag, etc.).
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.