Use the getIPFSFileMetadata method to retrieve metadata for a file stored on IPFS.

try {
  const cid = 'cid_here'; // The content identifier (CID) of the file.
  
  const ipfsMetadata = await sdk.file.getIPFSFileMetadata(cid);
  
  if (ipfsMetadata) {
    console.log(ipfsMetadata);
  } else {
    console.log('IPFS metadata not found.');
  }
} catch (error) {
  console.error(error.message);
}

Params

  • cid (string): The content identifier (CID) of the file.