const metadata = {
pinataContent: {
name: nftItem.name,
image: imageUrl,
description: nftItem.description,
external_url: nftItem.externalUrl,
attributes: nftItem.attributes || [],
},
pinataOptions: { wrapWithDirectory: nftList.length > 1 },
pinataMetadata: {
name: `${nftItem.id}`,
},
};
const pinataMetadata = await axios.post(
'https://api.pinata.cloud/pinning/pinJSONToIPFS',
metadata,
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${pinata.data.apiJwt}`,
},
},
);
here I mapping the nftList array, create metadata for every nftItem and trying to pin it. I know only that metadata have a spechial key "wrapWithDirectory", but a cant understand how it works.
The finish result what i wand - when nftList.length > 1 all json metadata files will have saved into 1 folder on pinata ploud account.
I would actually not use the
wrapWithDirectory
for this kind of upload as it won't accomplish what you're trying to do. If you want all of the metadata files to be in one folder you would need to try something like this