Skip to main content

Get Data As String

Get Data As String Function (Task)

void IPFS.IpfsFunctionLibrary.GetDataAsString(
IpfsHttpGatewayConfig ipfsHttpGatewayConfig,
IpfsAddress ipfsAddress)

This function gets data as string from the IPFS network for the specified CID/Path. This function requires inputs as follows:

  • ipfsHttpGatewayConfig: Holds the URL of the gateway to send the request to.
  • ipfsAddress: Holds the CID and path of the file on IPFS network.

The returned Response is a Task that holds data such as headers, status code, and body of the response of the HTTP request.

Task<(bool success, string errorMessage, HttpResponse response, string dataString)>
info

If success is true that only means that the response from the IPFS network was successful only.

If successful, returns the dataString which is the data returned in string format.

Get Data As String Function (Delegate)

void IPFS.IpfsFunctionLibrary.GetDataAsString(
IpfsHttpGatewayConfig ipfsHttpGatewayConfig,
IpfsAddress ipfsAddress,
IpfsGetDataAsStringDelegate responseDelegate)

This is a wrapper function for the async implementation. It exists to provide the same functionality but using a delegate for handling responses.

delegate void IpfsGetDataAsStringDelegate(
bool success,
string errorMessage,
HttpResponse response,
string dataString)