const file = fs.readFileSync(filepath);
const metadata = {
name: 'NFT Name',
description: 'NFT Description',
assetType: 'image',
...
}
let metadataObj = await web3storage.getMetadata(metadata, file);
console.log('metadataObj:', metadataObj);
var metadataString = JSON.stringify(metadataObj);
const metadataFilePath = '/tmp/metadata.json';
await fs.writeFileSync(metadataFilePath, metadataString);
const metadataFile = fs.readFileSync(metadataFilePath);
let cid = await web3storage.uploadFile(metadataFile);
console.log('metadata cid:', cid);
fs.unlinkSync(metadataFilePath);