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