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, error] = await sdk.file.getSiaFileMetadata({
cid
});
// Check for success
if (error) {
console.error('Failed to retrieve IPFS metadata:', error);
} else if (siaMetadata) {
console.log(siaMetadata);
}
} catch (error) {
console.error('An unexpected error occurred:', error.message);
}
Params
cid
(string): The content identifier (CID) of the file.