Use the getSiaFileMetadata method to retrieve metadata for a file stored on the Sia network.

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

Params

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