• Fetches a file from IPFS and returns it as an AssetNode or Uint8Array. One can setup their own IPFS node or use a service like kubo.

    Parameters

    • cid: string

      The CID of the file to fetch.

    • type: string

      The type of the file to fetch. If 'meta', the file is treated as JSON and parsed into an AssetNode. Otherwise, the file is treated as binary data and returned as a Uint8Array.

    • ipfsGateway: string

      The URL of the IPFS gateway to use.

    Returns Promise<null | AssetNode | Uint8Array>

    A promise that resolves with the fetched file as an AssetNode or Uint8Array, or null if the file could not be fetched.

    Throws

    If the CID is not provided, the IPFS gateway is not provided, or the file cannot be fetched.

Generated using TypeDoc