createPieceUrl
createPieceUrl(
options):string
Defined in: packages/synapse-core/src/utils/piece-url.ts:38
Create a piece URL for the CDN or PDP API
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options |
OptionsType |
createPieceUrl.OptionsType |
Returns
Section titled “Returns”string
The piece URL
Example
Section titled “Example”const pieceUrl = createPieceUrl({
cid: 'bafkzcibcd4bdomn3tgwgrh3g532zopskstnbrd2n3sxfqbze7rxt7vqn7veigmy',
cdn: true,
address: '0x1234567890123456789012345678901234567890',
chain: mainnet,
serviceURL: 'https://pdp.example.com',
})
console.log(pieceUrl) // https://0x1234567890123456789012345678901234567890.mainnet.filbeam.io/bafkzcibcd4bdomn3tgwgrh3g532zopskstnbrd2n3sxfqbze7rxt7vqn7veigmy