Skip to main content

Get Data As Image

Get Data As Image Function (Task)

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

This function gets data as image 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, Texture2D texture)>
info

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

If successful, returns the texture as Texture 2D object reference.

Get Data As Image Function (Delegate)

void IPFS.IpfsFunctionLibrary.GetDataAsImage(
IpfsHttpGatewayConfig ipfsHttpGatewayConfig,
IpfsAddress ipfsAddress,
IpfsGetDataAsImageDelegate 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 IpfsGetDataAsImageDelegate(
bool success,
string errorMessage,
HttpResponse response,
Texture2D texture)