> For the complete documentation index, see [llms.txt](https://docs.gra.fun/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gra.fun/tech-guide/cid-format.md).

# 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
    }
}
```

```
// Usage example
async function main() {
    const oldCID = 'QmdfLnJ22TFRPdvqKMirjxgVVRassP9Si8YqpK6nbBcZDw'
    try {
        const newCID = await convertCID(oldCID)
        console.log('Old CID:', oldCID)
        console.log('New CIDv1 (Base32):', newCID)
    } catch (error) {
        console.error('An error occurred:', error)
    } 
}
main()
```
