🧩CID Format
CID format Conversion Guide (node js)
import { CID } from 'multiformats/cid'
import { base32 } from 'multiformats/bases/base32'
async function convertCID(oldCID) {
try {
// Parse the old CID
const parsed = CID.parse(oldCID)
// Create new CIDv1 in base32
const newCID = parsed.toV1()
// Convert to base32 string
return newCID.toString(base32)
} catch (error) {
console.error('Error converting CID:', error)
throw error
}
}Last updated