# asPieceCID

```ts
function asPieceCID(pieceCidInput): PieceLink | null;
```

Defined in: [packages/synapse-core/src/piece.ts:137](https://github.com/FilOzone/synapse-sdk/blob/b006a8f0508ba111d0736f9a555fdb401c18990b/packages/synapse-core/src/piece.ts#L137)

Convert a PieceCID input (string or CID) to a validated CID
This is the main function to use when accepting PieceCID inputs

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `pieceCidInput` | \| `string` \| `PieceLink` \| `CID`\<`unknown`, `number`, `number`, `Version`\> \| `null` \| `undefined` | PieceCID as either a CID object or string |

## Returns

`PieceLink` \| `null`

The validated PieceCID CID or null if not a valid PieceCID