Skip to content

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

ParameterTypeDescription
optionsOptionsTypecreatePieceUrl.OptionsType

string

The piece URL

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