IPFS
public class IPFS
IPFS is a class that wraps a go-ipfs node and its shell over UDS
-
Undocumented
Declaration
Swift
public static let defaultRepoPath: String -
Class constructor using repoPath passed as parameter on internal storage
Throws
SockManagerError: If the initialization of SockManager failedConfigError: If the creation of the config failedRepoError: If the initialization of the repo failed
Declaration
Swift
public init(_ repoPath: String = defaultRepoPath) throwsParameters
repoPathThe path of the go-ipfs repo (default:
ipfs/repo) -
Returns the absolute repo path as an URL
Declaration
Swift
public func getAbsoluteRepoPath() -> URLReturn Value
The absolute repo path
-
Returns True if this IPFS instance is started by checking if the underlying go-ipfs node is instantiated
Declaration
Swift
public func isStarted() -> BoolReturn Value
True, if this IPFS instance is started
-
Starts this IPFS instance
Declaration
Swift
public func start() throws -
Stops this IPFS instance
Throws
IPFSError: If the node is already stopped or if its stop failsDeclaration
Swift
public func stop() throws -
Restarts this IPFS instance
Declaration
Swift
public func restart() throws -
Gets the IPFS instance config as a dict
Throws
RepoError: If the opening of the repo or the getting of its config failedConfigError: If the getting of the config as a dict failed
Seealso
IPFS Config DocDeclaration
Swift
public func getConfig() throws -> [String : Any]Return Value
The IPFS instance config as a dict
-
Sets dict config passed as parameter as IPFS config or reset to default config (with a new identity) if the config parameter is nil
Attention
A started IPFS instance must be restarted for its config to be appliedThrows
RepoError: If the opening of the repo or the setting of its config failedConfigError: If the setting of the config as a dict failed
Seealso
IPFS Config DocDeclaration
Swift
public func setConfig(_ config: [String : Any]? = nil) throwsParameters
configThe IPFS instance dict config to set (if nil, default config will be used)
-
Gets the dict value associated to the key passed as parameter in the IPFS instance config
Throws
RepoError: If the opening of the repo or the getting of its config failedConfigError: If the getting of the config value as a dict failed
Seealso
IPFS Config DocDeclaration
Swift
public func getConfigKey(_ key: String) throws -> [String : Any]Parameters
keyThe key associated to the value to get in the IPFS config
Return Value
The dict value associated to the key passed as parameter in the IPFS instance config
-
Sets dict config value to the key passed as parameters in the IPFS instance config
Attention
A started IPFS instance must be restarted for its config to be appliedThrows
RepoError: If the opening of the repo or the getting/setting of its config failedConfigError: If the setting of the config value as a dict failed
Seealso
IPFS Config DocDeclaration
Swift
public func setConfigKey(_ key: String, _ value: [String : Any]) throwsParameters
keyThe key associated to the value to set in the IPFS instance config
valueThe dict value associated to the key to set in the IPFS instance config
-
Creates and returns a RequestBuilder associated to this IPFS instance shell
Throws
IPFSError: If the request creaton failedDeclaration
Swift
public func newRequest(_ command: String) throws -> RequestBuilderParameters
commandThe command of the request
Return Value
A RequestBuilder based on the command passed as parameter
-
Serves node Gateway over the given Multiaddr
Throws
NodeError: If the node failed to serveDeclaration
Swift
public func serveGateway(onMultiaddr: String, _ writable: Bool = false) throws -> StringParameters
onMultiaddrThe multiaddr to serve on
writableIf true: will also support support
POST,PUT, andDELETEmethods. -
Serves node opi over the given TCPPort
Throws
NodeError: If the node failed to serveDeclaration
Swift
public func serveAPI(onTCPPort: String) throws -> StringParameters
onMultiaddrThe multiaddr to serve on
writableIf true: will also support support
POST,PUT, andDELETEmethods.
View on GitHub
IPFS Class Reference