# asPieceCID

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

Defined in: [packages/synapse-core/src/piece.ts:137](https://github.com/FilOzone/synapse-sdk/blob/1d6c4b9fe34534bf1087dfe41491b72be0b46858/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