Published
Edited
Sep 2, 2021
Insert cell
md`# Example for [#387](https://github.com/ipfs-shipyard/nft.storage/issues/387)`
Insert cell
Insert cell
Insert cell
Insert cell
client = new NFTStorage({
token: Secret("NFT_STORAGE_TOKEN")
})
Insert cell
image = FileAttachment("gozala.jpg").blob()
Insert cell
imageCID = client.storeBlob(image)
Insert cell
Insert cell
md`However you can represent same CID in V0 encoded as base58btc encoding`
Insert cell
Insert cell
imageCIDv0 = CID.parse(imageCID).toV0().toString()
Insert cell
md`You can inspect details at [${imageCIDv0}](https://cid.ipfs.io/#${imageCIDv0})`
Insert cell
metadata = ({
name: "gozala",
description: "gozala portrait",
image: `ipfs://${imageCID}`
})
Insert cell
metadataCID = client.storeBlob(new Blob([JSON.stringify(metadata)]))
Insert cell
Insert cell
Insert cell
CID.parse(metadataCID).toV0()
Insert cell
md`However you can still represent it in base58btc string`
Insert cell
Insert cell
cid58 = CID.parse(metadataCID).toString(base58btc)
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more