Reputation: 71
I uploaded file to NFT Storage
I can see file list in https://nft.storage/files/ but if I clicked CID links, I get error ipfs cat /ipfs/bafyreiayui2us6fpowl42vqwmjrntpewhqpfkbgcak6pt4gkpz55z2o3se/: unknown node type
My code is as below
const { NFTStorage, File } = require('nft.storage')
const apiKey ='eyJ........CJ9'
const client = new NFTStorage({ token: apiKey })
const metadata = await client.store({
name: artworkName,
description: description,
artistName: artistName,
image: new File(data, fileName, { type: artfile.mimetype }),
})
console.log(metadata.url)
I can see metadata.json and file on NFT Storage nft storage
I think, there is an issue for file size.
Please help me
Upvotes: 5
Views: 1437
Reputation: 21
Try:
ipfs cat <cid>/metadata.json
and from the JSON you will find a link to your image.
Upvotes: 1
Reputation: 885
Your metadata at https://ipfs.io/ipfs/bafyreiayui2us6fpowl42vqwmjrntpewhqpfkbgcak6pt4gkpz55z2o3se/metadata.json is:
{
"name": "PrettyDog",
"description": "This is my first artwork avatar",
"artistName": "Mark Petru ",
"image": "ipfs://bafybeig6sxdg4uggvnan6vxvshp7spm7kemmyqxnysyu3d5m57grefzhrq/test.jpg"
}
The image is then: https://ipfs.io/ipfs/bafybeig6sxdg4uggvnan6vxvshp7spm7kemmyqxnysyu3d5m57grefzhrq/test.jpg
Upvotes: 3